Main.java
package javaapplication10;
public class Main {
public static void main(String[] args) {
hFrame frames = new hFrame();
frames.hFrame();
}
}
hFrame.java
package javaapplication;
import java.awt.FlowLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JTextField;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
public class hFrame extends JFrame {
public void hFrame() throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException {
System.out.println("ssss");
JButton button = new JButton("Button");
JTextField text = new JTextField("text");
add(button);
add(text);
setLayout(new FlowLayout(5));
setVisible(true);
setAlwaysOnTop(true);
setSize(250, 250);
setTitle("Hello world");
setDefaultCloseOperation(EXIT_ON_CLOSE);
/*
Metal style
"javax.swing.plaf.metal.MetalLookAndFeel"
Motif style
com.sun.java.swing.plaf.motif.MotifLookAndFeel
Windows style
"com.sun.java.swing.plaf.windows.WindowsLookAndFeel"
*/
UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
SwingUtilities.updateComponentTreeUI(this);
}
}
Комментариев нет:
Отправить комментарий