java jbutton 的问题
importjava.awt.*;importjava.awt.event.*;importjavax.swing.*;publicclassmainPageextend...
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class mainPage extends JFrame {
/**
* @param args
*/
Icon iconOld = new ImageIcon("F:/workspace/xiaoqian/old.jpg");
Icon iconNew = new ImageIcon("F:/workspace/xiaoqian/new.bmp");
Icon iconFinish = new ImageIcon("F:/workspace/xiaoqian/finish.jpg");
private JLabel textJLabel;
private JLabel pictureJLabel;
private JButton startJButton;
private JButton readJButton;
private JButton finishJButton;
public mainPage(){
createUserInterface();
}
private void createUserInterface(){
Container mainPane = getContentPane();
mainPane.setBackground(Color.LIGHT_GRAY);
mainPane.setLayout(null);
startJButton = new JButton(iconNew);
startJButton.setBounds(35,395,160,30);
mainPane.add(startJButton);
readJButton = new JButton();
readJButton.setIcon(iconOld);
readJButton.setBounds(300,395,60,30);
mainPane.add(readJButton);
finishJButton = new JButton(iconFinish);
finishJButton.setBounds(565,395,160,30);
mainPane.add(finishJButton);
setTitle("小倩"); // set JFrame's title bar string
setSize(770, 511); // set width and height of JFrame
setVisible(true); // display JFrame on screen
setResizable(false);
setLocation(200,200);
}
public static void main(String[] args) {
// TODO Auto-generated method stub
mainPage application = new mainPage();
application.setDefaultCloseOperation(EXIT_ON_CLOSE);
}
一个图片也显示不出来 那位大神救救我啊 。。
如果成功的话再加50分 多谢啦 。。。 展开
import java.awt.event.*;
import javax.swing.*;
public class mainPage extends JFrame {
/**
* @param args
*/
Icon iconOld = new ImageIcon("F:/workspace/xiaoqian/old.jpg");
Icon iconNew = new ImageIcon("F:/workspace/xiaoqian/new.bmp");
Icon iconFinish = new ImageIcon("F:/workspace/xiaoqian/finish.jpg");
private JLabel textJLabel;
private JLabel pictureJLabel;
private JButton startJButton;
private JButton readJButton;
private JButton finishJButton;
public mainPage(){
createUserInterface();
}
private void createUserInterface(){
Container mainPane = getContentPane();
mainPane.setBackground(Color.LIGHT_GRAY);
mainPane.setLayout(null);
startJButton = new JButton(iconNew);
startJButton.setBounds(35,395,160,30);
mainPane.add(startJButton);
readJButton = new JButton();
readJButton.setIcon(iconOld);
readJButton.setBounds(300,395,60,30);
mainPane.add(readJButton);
finishJButton = new JButton(iconFinish);
finishJButton.setBounds(565,395,160,30);
mainPane.add(finishJButton);
setTitle("小倩"); // set JFrame's title bar string
setSize(770, 511); // set width and height of JFrame
setVisible(true); // display JFrame on screen
setResizable(false);
setLocation(200,200);
}
public static void main(String[] args) {
// TODO Auto-generated method stub
mainPage application = new mainPage();
application.setDefaultCloseOperation(EXIT_ON_CLOSE);
}
一个图片也显示不出来 那位大神救救我啊 。。
如果成功的话再加50分 多谢啦 。。。 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询