package pack10;import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Test
{
public static void main(String[] args)
{
EventQueue.invokeLater(new Runnable()
{
public void run()
{
ButtonFrame frame=new ButtonFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
});
}
}
class ButtonFrame extends JFrame
{
public ButtonFrame()
{
setTitle("Button Test");
setSize(W,H);
JButton yellowButton=new JButton("Yellow");
JButton blueButton=new JButton("Blue");
JButton redButton=new JButton("Red");
//JButton ha=new JButton("h");
buttonPanel=new JPanel();
buttonPanel.add(yellowButton);
buttonPanel.add(blueButton);
buttonPanel.add(redButton);
//buttonPanel.add(ha);
add(buttonPanel);
ActionListener yellowAction=new ColorAction(Color.YELLOW);
ActionListener blueAction=new ColorAction(Color.BLUE);
ActionListener redAction=new ColorAction(Color.RED);
yellowButton.addActionListener(yellowAction);
blueButton.addActionListener(blueAction);
redButton.addActionListener(redAction); }
private class ColorAction implements ActionListener
{
public ColorAction(Color c)
{
backgroundColor=c;
}
public void actionPerformed(ActionEvent event)
{
buttonPanel.setBackground(backgroundColor); //断点设在此处 }
private Color backgroundColor;
} private JPanel buttonPanel;
private static final int W=300;
private static final int H=200;}如注释所示,断点设在那句话上。
我的问题是:这个程序可以正常运行,但在调试时却出现了"source not found"的问题,下面还有个按钮“Edit Source Lookup Path”请问这是怎么回事?
import java.awt.event.*;
import javax.swing.*;
public class Test
{
public static void main(String[] args)
{
EventQueue.invokeLater(new Runnable()
{
public void run()
{
ButtonFrame frame=new ButtonFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
});
}
}
class ButtonFrame extends JFrame
{
public ButtonFrame()
{
setTitle("Button Test");
setSize(W,H);
JButton yellowButton=new JButton("Yellow");
JButton blueButton=new JButton("Blue");
JButton redButton=new JButton("Red");
//JButton ha=new JButton("h");
buttonPanel=new JPanel();
buttonPanel.add(yellowButton);
buttonPanel.add(blueButton);
buttonPanel.add(redButton);
//buttonPanel.add(ha);
add(buttonPanel);
ActionListener yellowAction=new ColorAction(Color.YELLOW);
ActionListener blueAction=new ColorAction(Color.BLUE);
ActionListener redAction=new ColorAction(Color.RED);
yellowButton.addActionListener(yellowAction);
blueButton.addActionListener(blueAction);
redButton.addActionListener(redAction); }
private class ColorAction implements ActionListener
{
public ColorAction(Color c)
{
backgroundColor=c;
}
public void actionPerformed(ActionEvent event)
{
buttonPanel.setBackground(backgroundColor); //断点设在此处 }
private Color backgroundColor;
} private JPanel buttonPanel;
private static final int W=300;
private static final int H=200;}如注释所示,断点设在那句话上。
我的问题是:这个程序可以正常运行,但在调试时却出现了"source not found"的问题,下面还有个按钮“Edit Source Lookup Path”请问这是怎么回事?
解决方案 »
- 自己模拟Map集合实现,二维数组中有点想不明白
- 使用POI的cloneSheet方法报错,求助
- 菜鸟求解 还请给为大牛多多指教哈
- J2SE + SQL Server 开发的桌面程序能打包成安装程序
- SWT table 如何使得里面的内容可以复制
- Exception occurred during event dispatching 数据库操作异常 不知怎么解决
- 我想做个画图程序,想请问如何改变鼠标形状?
- 应该如何进行MS SQL Server 2000的jdbc配置
- 问一个servlet和applet通信地问题,请各位来看一下。
- JAVA进销存管理系统运行问题
- 问下,如果要用java开发即时通信工具,需要掌握那些知识哦?
- 企业短信系统平台的设计(毕业设计)
我使用的是jdk 1.5 eclipse 3.3