ini lanjutan dari coding class yg sebelumnya, masih dalam 1 proyek yg sama:
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package GUI2;
/**
*
* @author steven
*/
import javax.swing.*;
import java.awt.*;
public class WindowUtilities {
public static void setNativeLookAndFeel(){
try{
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch(Exception e){
System.out.println("Error Setting Native LAF: " + e);
}
}
public static JFrame openInJFrame(Container content,
int width,
int height,
String title,
Color bgColor) {
JFrame frame = new JFrame(title);
frame.setBackground(bgColor);
content.setBackground(bgColor);
frame.setSize(width, height);
frame.setContentPane(content);
frame.addWindowListener(new ExitListener());
frame.setVisible(true);
return(frame);
}
public static JFrame openInJFrame(Container content,
int width,
int height,
String title) {
return(openInJFrame(content, width, height, title, Color.WHITE));
}
public static JFrame openInJFrame(Container content,
int width,
int height) {
return(openInJFrame(content, width, height,
content.getClass().getName(),
Color.WHITE));
}
}
Tidak ada komentar:
Posting Komentar