请问下面这段代码的错误原因(错误的地方都有注释),一共22处错误,但是只有两种错误类型,最好可以贴出修改代码?急急急!
import java.util.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.table.*;
public class MyWork
{
public static void main(String args[])
{
GJApp.launch(new Jf(),"泰能电子",150,150,600,350); //cannot resolve symbol:Class GJApp
}
}
class Jf extends JFrame
{
public Jf()
{
getContentPane().add(new Jsp(),BorderLayout.CENTER);
getContentPane().add(new TopPanel(),BorderLayout.NORTH);
getContentPane().add(new LeftPanel(),BorderLayout.LEFT);//cannot resolve symbol:LeftPanel(),LEFT
}
}
class Jsp extends JScrollPane
{
int rows=3,cols=5;
Object[] rowData=new Object[cols];
DefaultTableModel model=new DefaultTableModel();
JTable table=new JTable(model);
Jsp()
{
for (int c=0;c<cols;c++)
{
model.addColumn("Column"+Integer.toString(c));
}
for (int r=0;r<rows;r++)
{
for (int c=0;c<cols;c++)
{
rowData[c]="("+r+","+c+")";
}
model.addRow(rowData);
}
}
}
class TopPanel extends JPanel
{
JButton rowBtn=new JButton("增加记录");
JButton colBtn=new JButton("增加字段");
JButton saveBtn=new JButton("保存");
JButton delBtn=new JButton("删除");
JButton exitBtn=new JButton("退出");
TopPanel()
{
setLayout(new FlowLayout());
add(rowBtn);
add(colBtn);
add(saveBtn);
add(delBtn);
add(exitBtn);
rowBtn.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
int rowCount=model.getRowCount();//cannot resolve symbol:variable model
int colCount=model.getColumnCount();//cannot resolve symbol:variable model
if (colCount>rowData.length)//cannot resolve symbol:variable rowData
{
rowData=new Object[colCount];//cannot resolve symbol:variable rowData
}
for (int c=0;c<cols;c++)//cannot resolve symbol:variable cols
{
rowData[c]="("+rowCount+","+c+")";//cannot resolve symbol:variable rowData
}
model.addRow(rowData);//cannot resolve symbol:variable model,rowData
}
}
);
colBtn.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
int colCount=model.getColumnCount();//cannot resolve symbol:variable model
model.addColumn("Column"+colCount);//cannot resolve symbol:variable model
table.sizeColumnToFit(-1);//cannot resolve symbol:variable table
}
}
);
saveBtn.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
}
}
);
delBtn.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
}
}
);
exitBtn.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
}
}
);
}
class LeftPanel extends JPanel
{
LeftPanel()
{
setBackground(Color.green);
}
}
class GJApp extends WindowAdapter
{
static private JPanel statusArea=new JPanel();//inner classes cannot have static declarations
static private JLabel status=new JLabel("");//inner classes cannot have static declarations
static private ResourceBundle resources;//inner classes cannot have static declarations
public static void launch(final JFrame f,String title,final int x,final int y,final int w,final int h)//inner classes cannot have static declarations
{
launch(f,title,x,y,w,h,null);
}
public static void launch(final JFrame f,String title,final int x,final int y,final int w,final int h,String propertiesFilename)//inner classes cannot have static declarations
{
f.setTitle(title);
f.setBounds(x,y,w,h);
f.setVisible(true);
statusArea.setBorder(BorderFactory.createEtchedBorder());
statusArea.setLayout(new FlowLayout(FlowLayout.LEFT,0,0));
statusArea.add(status);
status.setHorizontalAlignment(JLabel.LEFT);
f.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
if(propertiesFilename!=null)
{
resources=ResourceBundle.getBundle(propertiesFilename,Locale.getDefault());
}
f.addWindowListener(new WindowAdapter()
{
public void windowClosed(WindowEvent e)
{
System.exit(0);
}
}
);
}
static public JPanel getStatusArea()//inner classes cannot have static declarations
{
return statusArea;
}
static public void showStatus(String s)//inner classes cannot have static declarations
{
status.setText(s);
}
static String getResource(String key)//inner classes cannot have static declarations
{
if(resources!=null)
{
return resources.getString(key);
}
return null;
}
}
}
7 个解决方案
#1
1) 将 GJApp 中static 去掉
2)将table 和 model 传入 各个 jpanel 中
2)将table 和 model 传入 各个 jpanel 中
#2
1)果然有用!能讲下原因吗?我虽然理论上知道static,public,private,protected的作用,但是编程的时候,总是不知道这里到底该用哪个。还有这个GJApp类的主要作用到底是什么阿?我在《Java 2 图形设计 Swing》里看到说每个应用程序都要用到这个类的,我就照抄了书上的GJApp代码。搞不懂既然每个应用程序都要用,为什么不放到Class里去阿,还要我们自己写?
2)具体怎么操作??JTable和model一定要放在容器中,才能再放到JFrame里吗??
为什么??
帮我搞懂了,100分全给你,不够再加。
2)具体怎么操作??JTable和model一定要放在容器中,才能再放到JFrame里吗??
为什么??
帮我搞懂了,100分全给你,不够再加。
#3
class GJApp extends WindowAdapter
~~~~~~~~~~~~~事件监听
你看看 WindowAdapter 类的方法
将table 和 model 作为扩展jpane类的参数,不然扩展jpane类不知道table 和 model
~~~~~~~~~~~~~事件监听
你看看 WindowAdapter 类的方法
将table 和 model 作为扩展jpane类的参数,不然扩展jpane类不知道table 和 model
#4
老大,你这段程序诊锻炼人!!改完以后,足够可以去拿SCJP了
如下,没问题!
import java.util.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.table.*;
public class MyWork
{
public static void main(String args[])
{
Jsp jsp = new Jsp();
TopPanel panel= new TopPanel(jsp);
TopPanel.GJApp app= panel.new GJApp();
app.launch(new Jf(panel,jsp),"泰能电子",150,150,600,350); //cannot resolve symbol:Class GJApp
}
}
class Jf extends JFrame
{
public Jf(TopPanel panel,Jsp jsp)
{
getContentPane().add(jsp,BorderLayout.CENTER);
getContentPane().add(panel,BorderLayout.NORTH);
getContentPane().add(panel.new LeftPanel(),BorderLayout.EAST);//cannot resolve symbol:LeftPanel(),LEFT
}
}
class Jsp extends JScrollPane
{
int rows=3,cols=5;
Object[] rowData=new Object[cols];
public DefaultTableModel model=new DefaultTableModel();
JTable table=new JTable(model);
Jsp()
{
for (int c=0;c<cols;c++)
{
model.addColumn("Column"+Integer.toString(c));
}
for (int r=0;r<rows;r++)
{
for (int c=0;c<cols;c++)
{
rowData[c]="("+r+","+c+")";
}
model.addRow(rowData);
}
}
}
class TopPanel extends JPanel
{
JButton rowBtn=new JButton("增加记录");
JButton colBtn=new JButton("增加字段");
JButton saveBtn=new JButton("保存");
JButton delBtn=new JButton("删除");
JButton exitBtn=new JButton("退出");
TopPanel(final Jsp jsp)
{
setLayout(new FlowLayout());
add(rowBtn);
add(colBtn);
add(saveBtn);
add(delBtn);
add(exitBtn);
rowBtn.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
int rowCount=jsp.model.getRowCount();//cannot resolve symbol:variable model
int colCount=jsp.model.getColumnCount();//cannot resolve symbol:variable model
if (colCount>jsp.rowData.length)//cannot resolve symbol:variable rowData
{
jsp.rowData=new Object[colCount];//cannot resolve symbol:variable rowData
}
for (int c=0;c<jsp.cols;c++)//cannot resolve symbol:variable cols
{
jsp.rowData[c]="("+rowCount+","+c+")";//cannot resolve symbol:variable rowData
}
jsp.model.addRow(jsp.rowData);//cannot resolve symbol:variable model,rowData
}
}
);
colBtn.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
int colCount=jsp.model.getColumnCount();//cannot resolve symbol:variable model
jsp.model.addColumn("Column"+colCount);//cannot resolve symbol:variable model
jsp.table.sizeColumnsToFit(-1);//cannot resolve symbol:variable table
}
}
);
saveBtn.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
}
}
);
delBtn.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
}
}
);
exitBtn.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
}
}
);
}
class LeftPanel extends JPanel
{
LeftPanel()
{
setBackground(Color.green);
}
}
public class GJApp extends WindowAdapter
{
private JPanel statusArea=new JPanel();//inner classes cannot have static declarations
private JLabel status=new JLabel("");//inner classes cannot have static declarations
private ResourceBundle resources;//inner classes cannot have static declarations
public void launch(final JFrame f,String title,final int x,final int y,final int w,final int h)//inner classes cannot have static declarations
{
launch(f,title,x,y,w,h,null);
}
public void launch(final JFrame f,String title,final int x,final int y,final int w,final int h,String propertiesFilename)//inner classes cannot have static declarations
{
f.setTitle(title);
f.setBounds(x,y,w,h);
f.setVisible(true);
statusArea.setBorder(BorderFactory.createEtchedBorder());
statusArea.setLayout(new FlowLayout(FlowLayout.LEFT,0,0));
statusArea.add(status);
status.setHorizontalAlignment(JLabel.LEFT);
f.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
if(propertiesFilename!=null)
{
resources=ResourceBundle.getBundle(propertiesFilename,Locale.getDefault());
}
f.addWindowListener(new WindowAdapter()
{
public void windowClosed(WindowEvent e)
{
System.exit(0);
}
}
);
}
public JPanel getStatusArea()//inner classes cannot have static declarations
{
return statusArea;
}
public void showStatus(String s)//inner classes cannot have static declarations
{
status.setText(s);
}
String getResource(String key)//inner classes cannot have static declarations
{
if(resources!=null)
{
return resources.getString(key);
}
return null;
}
}
}
如下,没问题!
import java.util.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.table.*;
public class MyWork
{
public static void main(String args[])
{
Jsp jsp = new Jsp();
TopPanel panel= new TopPanel(jsp);
TopPanel.GJApp app= panel.new GJApp();
app.launch(new Jf(panel,jsp),"泰能电子",150,150,600,350); //cannot resolve symbol:Class GJApp
}
}
class Jf extends JFrame
{
public Jf(TopPanel panel,Jsp jsp)
{
getContentPane().add(jsp,BorderLayout.CENTER);
getContentPane().add(panel,BorderLayout.NORTH);
getContentPane().add(panel.new LeftPanel(),BorderLayout.EAST);//cannot resolve symbol:LeftPanel(),LEFT
}
}
class Jsp extends JScrollPane
{
int rows=3,cols=5;
Object[] rowData=new Object[cols];
public DefaultTableModel model=new DefaultTableModel();
JTable table=new JTable(model);
Jsp()
{
for (int c=0;c<cols;c++)
{
model.addColumn("Column"+Integer.toString(c));
}
for (int r=0;r<rows;r++)
{
for (int c=0;c<cols;c++)
{
rowData[c]="("+r+","+c+")";
}
model.addRow(rowData);
}
}
}
class TopPanel extends JPanel
{
JButton rowBtn=new JButton("增加记录");
JButton colBtn=new JButton("增加字段");
JButton saveBtn=new JButton("保存");
JButton delBtn=new JButton("删除");
JButton exitBtn=new JButton("退出");
TopPanel(final Jsp jsp)
{
setLayout(new FlowLayout());
add(rowBtn);
add(colBtn);
add(saveBtn);
add(delBtn);
add(exitBtn);
rowBtn.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
int rowCount=jsp.model.getRowCount();//cannot resolve symbol:variable model
int colCount=jsp.model.getColumnCount();//cannot resolve symbol:variable model
if (colCount>jsp.rowData.length)//cannot resolve symbol:variable rowData
{
jsp.rowData=new Object[colCount];//cannot resolve symbol:variable rowData
}
for (int c=0;c<jsp.cols;c++)//cannot resolve symbol:variable cols
{
jsp.rowData[c]="("+rowCount+","+c+")";//cannot resolve symbol:variable rowData
}
jsp.model.addRow(jsp.rowData);//cannot resolve symbol:variable model,rowData
}
}
);
colBtn.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
int colCount=jsp.model.getColumnCount();//cannot resolve symbol:variable model
jsp.model.addColumn("Column"+colCount);//cannot resolve symbol:variable model
jsp.table.sizeColumnsToFit(-1);//cannot resolve symbol:variable table
}
}
);
saveBtn.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
}
}
);
delBtn.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
}
}
);
exitBtn.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
}
}
);
}
class LeftPanel extends JPanel
{
LeftPanel()
{
setBackground(Color.green);
}
}
public class GJApp extends WindowAdapter
{
private JPanel statusArea=new JPanel();//inner classes cannot have static declarations
private JLabel status=new JLabel("");//inner classes cannot have static declarations
private ResourceBundle resources;//inner classes cannot have static declarations
public void launch(final JFrame f,String title,final int x,final int y,final int w,final int h)//inner classes cannot have static declarations
{
launch(f,title,x,y,w,h,null);
}
public void launch(final JFrame f,String title,final int x,final int y,final int w,final int h,String propertiesFilename)//inner classes cannot have static declarations
{
f.setTitle(title);
f.setBounds(x,y,w,h);
f.setVisible(true);
statusArea.setBorder(BorderFactory.createEtchedBorder());
statusArea.setLayout(new FlowLayout(FlowLayout.LEFT,0,0));
statusArea.add(status);
status.setHorizontalAlignment(JLabel.LEFT);
f.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
if(propertiesFilename!=null)
{
resources=ResourceBundle.getBundle(propertiesFilename,Locale.getDefault());
}
f.addWindowListener(new WindowAdapter()
{
public void windowClosed(WindowEvent e)
{
System.exit(0);
}
}
);
}
public JPanel getStatusArea()//inner classes cannot have static declarations
{
return statusArea;
}
public void showStatus(String s)//inner classes cannot have static declarations
{
status.setText(s);
}
String getResource(String key)//inner classes cannot have static declarations
{
if(resources!=null)
{
return resources.getString(key);
}
return null;
}
}
}
#5
老大,你怎么改的,编译通过,运行的时候出现Exception啊
#6
对不起,我错了,刚才JDK没配置好.
能不能讲讲错的原因啊
能不能讲讲错的原因啊
#7
怎么没有人回复啊?还有80分没给啊
#1
1) 将 GJApp 中static 去掉
2)将table 和 model 传入 各个 jpanel 中
2)将table 和 model 传入 各个 jpanel 中
#2
1)果然有用!能讲下原因吗?我虽然理论上知道static,public,private,protected的作用,但是编程的时候,总是不知道这里到底该用哪个。还有这个GJApp类的主要作用到底是什么阿?我在《Java 2 图形设计 Swing》里看到说每个应用程序都要用到这个类的,我就照抄了书上的GJApp代码。搞不懂既然每个应用程序都要用,为什么不放到Class里去阿,还要我们自己写?
2)具体怎么操作??JTable和model一定要放在容器中,才能再放到JFrame里吗??
为什么??
帮我搞懂了,100分全给你,不够再加。
2)具体怎么操作??JTable和model一定要放在容器中,才能再放到JFrame里吗??
为什么??
帮我搞懂了,100分全给你,不够再加。
#3
class GJApp extends WindowAdapter
~~~~~~~~~~~~~事件监听
你看看 WindowAdapter 类的方法
将table 和 model 作为扩展jpane类的参数,不然扩展jpane类不知道table 和 model
~~~~~~~~~~~~~事件监听
你看看 WindowAdapter 类的方法
将table 和 model 作为扩展jpane类的参数,不然扩展jpane类不知道table 和 model
#4
老大,你这段程序诊锻炼人!!改完以后,足够可以去拿SCJP了
如下,没问题!
import java.util.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.table.*;
public class MyWork
{
public static void main(String args[])
{
Jsp jsp = new Jsp();
TopPanel panel= new TopPanel(jsp);
TopPanel.GJApp app= panel.new GJApp();
app.launch(new Jf(panel,jsp),"泰能电子",150,150,600,350); //cannot resolve symbol:Class GJApp
}
}
class Jf extends JFrame
{
public Jf(TopPanel panel,Jsp jsp)
{
getContentPane().add(jsp,BorderLayout.CENTER);
getContentPane().add(panel,BorderLayout.NORTH);
getContentPane().add(panel.new LeftPanel(),BorderLayout.EAST);//cannot resolve symbol:LeftPanel(),LEFT
}
}
class Jsp extends JScrollPane
{
int rows=3,cols=5;
Object[] rowData=new Object[cols];
public DefaultTableModel model=new DefaultTableModel();
JTable table=new JTable(model);
Jsp()
{
for (int c=0;c<cols;c++)
{
model.addColumn("Column"+Integer.toString(c));
}
for (int r=0;r<rows;r++)
{
for (int c=0;c<cols;c++)
{
rowData[c]="("+r+","+c+")";
}
model.addRow(rowData);
}
}
}
class TopPanel extends JPanel
{
JButton rowBtn=new JButton("增加记录");
JButton colBtn=new JButton("增加字段");
JButton saveBtn=new JButton("保存");
JButton delBtn=new JButton("删除");
JButton exitBtn=new JButton("退出");
TopPanel(final Jsp jsp)
{
setLayout(new FlowLayout());
add(rowBtn);
add(colBtn);
add(saveBtn);
add(delBtn);
add(exitBtn);
rowBtn.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
int rowCount=jsp.model.getRowCount();//cannot resolve symbol:variable model
int colCount=jsp.model.getColumnCount();//cannot resolve symbol:variable model
if (colCount>jsp.rowData.length)//cannot resolve symbol:variable rowData
{
jsp.rowData=new Object[colCount];//cannot resolve symbol:variable rowData
}
for (int c=0;c<jsp.cols;c++)//cannot resolve symbol:variable cols
{
jsp.rowData[c]="("+rowCount+","+c+")";//cannot resolve symbol:variable rowData
}
jsp.model.addRow(jsp.rowData);//cannot resolve symbol:variable model,rowData
}
}
);
colBtn.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
int colCount=jsp.model.getColumnCount();//cannot resolve symbol:variable model
jsp.model.addColumn("Column"+colCount);//cannot resolve symbol:variable model
jsp.table.sizeColumnsToFit(-1);//cannot resolve symbol:variable table
}
}
);
saveBtn.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
}
}
);
delBtn.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
}
}
);
exitBtn.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
}
}
);
}
class LeftPanel extends JPanel
{
LeftPanel()
{
setBackground(Color.green);
}
}
public class GJApp extends WindowAdapter
{
private JPanel statusArea=new JPanel();//inner classes cannot have static declarations
private JLabel status=new JLabel("");//inner classes cannot have static declarations
private ResourceBundle resources;//inner classes cannot have static declarations
public void launch(final JFrame f,String title,final int x,final int y,final int w,final int h)//inner classes cannot have static declarations
{
launch(f,title,x,y,w,h,null);
}
public void launch(final JFrame f,String title,final int x,final int y,final int w,final int h,String propertiesFilename)//inner classes cannot have static declarations
{
f.setTitle(title);
f.setBounds(x,y,w,h);
f.setVisible(true);
statusArea.setBorder(BorderFactory.createEtchedBorder());
statusArea.setLayout(new FlowLayout(FlowLayout.LEFT,0,0));
statusArea.add(status);
status.setHorizontalAlignment(JLabel.LEFT);
f.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
if(propertiesFilename!=null)
{
resources=ResourceBundle.getBundle(propertiesFilename,Locale.getDefault());
}
f.addWindowListener(new WindowAdapter()
{
public void windowClosed(WindowEvent e)
{
System.exit(0);
}
}
);
}
public JPanel getStatusArea()//inner classes cannot have static declarations
{
return statusArea;
}
public void showStatus(String s)//inner classes cannot have static declarations
{
status.setText(s);
}
String getResource(String key)//inner classes cannot have static declarations
{
if(resources!=null)
{
return resources.getString(key);
}
return null;
}
}
}
如下,没问题!
import java.util.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.table.*;
public class MyWork
{
public static void main(String args[])
{
Jsp jsp = new Jsp();
TopPanel panel= new TopPanel(jsp);
TopPanel.GJApp app= panel.new GJApp();
app.launch(new Jf(panel,jsp),"泰能电子",150,150,600,350); //cannot resolve symbol:Class GJApp
}
}
class Jf extends JFrame
{
public Jf(TopPanel panel,Jsp jsp)
{
getContentPane().add(jsp,BorderLayout.CENTER);
getContentPane().add(panel,BorderLayout.NORTH);
getContentPane().add(panel.new LeftPanel(),BorderLayout.EAST);//cannot resolve symbol:LeftPanel(),LEFT
}
}
class Jsp extends JScrollPane
{
int rows=3,cols=5;
Object[] rowData=new Object[cols];
public DefaultTableModel model=new DefaultTableModel();
JTable table=new JTable(model);
Jsp()
{
for (int c=0;c<cols;c++)
{
model.addColumn("Column"+Integer.toString(c));
}
for (int r=0;r<rows;r++)
{
for (int c=0;c<cols;c++)
{
rowData[c]="("+r+","+c+")";
}
model.addRow(rowData);
}
}
}
class TopPanel extends JPanel
{
JButton rowBtn=new JButton("增加记录");
JButton colBtn=new JButton("增加字段");
JButton saveBtn=new JButton("保存");
JButton delBtn=new JButton("删除");
JButton exitBtn=new JButton("退出");
TopPanel(final Jsp jsp)
{
setLayout(new FlowLayout());
add(rowBtn);
add(colBtn);
add(saveBtn);
add(delBtn);
add(exitBtn);
rowBtn.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
int rowCount=jsp.model.getRowCount();//cannot resolve symbol:variable model
int colCount=jsp.model.getColumnCount();//cannot resolve symbol:variable model
if (colCount>jsp.rowData.length)//cannot resolve symbol:variable rowData
{
jsp.rowData=new Object[colCount];//cannot resolve symbol:variable rowData
}
for (int c=0;c<jsp.cols;c++)//cannot resolve symbol:variable cols
{
jsp.rowData[c]="("+rowCount+","+c+")";//cannot resolve symbol:variable rowData
}
jsp.model.addRow(jsp.rowData);//cannot resolve symbol:variable model,rowData
}
}
);
colBtn.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
int colCount=jsp.model.getColumnCount();//cannot resolve symbol:variable model
jsp.model.addColumn("Column"+colCount);//cannot resolve symbol:variable model
jsp.table.sizeColumnsToFit(-1);//cannot resolve symbol:variable table
}
}
);
saveBtn.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
}
}
);
delBtn.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
}
}
);
exitBtn.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
}
}
);
}
class LeftPanel extends JPanel
{
LeftPanel()
{
setBackground(Color.green);
}
}
public class GJApp extends WindowAdapter
{
private JPanel statusArea=new JPanel();//inner classes cannot have static declarations
private JLabel status=new JLabel("");//inner classes cannot have static declarations
private ResourceBundle resources;//inner classes cannot have static declarations
public void launch(final JFrame f,String title,final int x,final int y,final int w,final int h)//inner classes cannot have static declarations
{
launch(f,title,x,y,w,h,null);
}
public void launch(final JFrame f,String title,final int x,final int y,final int w,final int h,String propertiesFilename)//inner classes cannot have static declarations
{
f.setTitle(title);
f.setBounds(x,y,w,h);
f.setVisible(true);
statusArea.setBorder(BorderFactory.createEtchedBorder());
statusArea.setLayout(new FlowLayout(FlowLayout.LEFT,0,0));
statusArea.add(status);
status.setHorizontalAlignment(JLabel.LEFT);
f.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
if(propertiesFilename!=null)
{
resources=ResourceBundle.getBundle(propertiesFilename,Locale.getDefault());
}
f.addWindowListener(new WindowAdapter()
{
public void windowClosed(WindowEvent e)
{
System.exit(0);
}
}
);
}
public JPanel getStatusArea()//inner classes cannot have static declarations
{
return statusArea;
}
public void showStatus(String s)//inner classes cannot have static declarations
{
status.setText(s);
}
String getResource(String key)//inner classes cannot have static declarations
{
if(resources!=null)
{
return resources.getString(key);
}
return null;
}
}
}
#5
老大,你怎么改的,编译通过,运行的时候出现Exception啊
#6
对不起,我错了,刚才JDK没配置好.
能不能讲讲错的原因啊
能不能讲讲错的原因啊
#7
怎么没有人回复啊?还有80分没给啊