Tuesday, April 28, 2009

Maximize کردن Jframe و از بین بردن border

Maximize کردن jframe و از بین بردن border فریم

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;


public class FullScreenJFrame extends JFrame {

public FullScreenJFrame(String title) {
super(title);

this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);

setUndecorated(true);
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
setBounds(0, 0, screenSize.width, screenSize.height);
getContentPane().add(new JLabel("A JFrame Based Kiosk"), BorderLayout.NORTH);
JButton closeButton = new JButton("Close");
closeButton.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent ae) {
System.out.println("Close button Pressed");
FullScreenJFrame.this.setVisible(false);
System.exit(0);
}
});
getContentPane().add(closeButton, BorderLayout.CENTER);
}

public static void main(String[] args) {
FullScreenJFrame frame = new FullScreenJFrame("");
frame.setVisible(true);
}
}
به نقل از : saeedIRHA

No comments:

Post a Comment