1
下面的例子将显示一个带有jframe窗口的按钮。我只想要按钮可见,它如何实现?如何只显示带有输出jframe或jpanel的按钮可见?
public final void initUI() {
JPanel panel = new JPanel();
getContentPane().add(panel);
panel.setLayout(null);
JButton quitButton = new JButton("Quit");
quitButton.setBounds(50, 60, 80, 30);
quitButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event) {
System.exit(0);
}
});
panel.add(quitButton);
setTitle("Quit button");
setSize(300, 200);
setLocationRelativeTo(null);
setDefaultCloseOperation(EXIT_ON_CLOSE);
}
无框 - >无按钮 – Gee858eeG
+1哦..那么人们在图像上显示按钮的常见做法是什么(启动画面,.jpg等)? –