feisty meow concerns codebase  2.140
WindowUtilities.java
Go to the documentation of this file.
1 package org.feistymeow.windowing;
2 
3 import javax.swing.*;
4 import java.awt.*;
5 
10 public class WindowUtilities {
11 
16  public static void setNativeLookAndFeel() {
17  try {
18  UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
19  } catch(Exception e) {
20  System.out.println("Error setting native LAF: " + e);
21  }
22  }
23 
24  public static void setJavaLookAndFeel() {
25  try {
26  UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
27  } catch(Exception e) {
28  System.out.println("Error setting Java LAF: " + e);
29  }
30  }
31 
32  public static void setMotifLookAndFeel() {
33  try {
34  UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel");
35  } catch(Exception e) {
36  System.out.println("Error setting Motif LAF: " + e);
37  }
38  }
39 
44  public static JFrame openInJFrame(Container content,
45  int width,
46  int height,
47  String title,
48  Color bgColor) {
49  JFrame frame = new JFrame(title);
50  frame.setBackground(bgColor);
51  content.setBackground(bgColor);
52  frame.setSize(width, height);
53  frame.setContentPane(content);
54  frame.addWindowListener(new ExitListener());
55  frame.setVisible(true);
56  return(frame);
57  }
58 
61  public static JFrame openInJFrame(Container content,
62  int width,
63  int height,
64  String title) {
65  return(openInJFrame(content, width, height, title, Color.white));
66  }
67 
72  public static JFrame openInJFrame(Container content,
73  int width,
74  int height) {
75  return(openInJFrame(content, width, height,
76  content.getClass().getName(),
77  Color.white));
78  }
79 }
static JFrame openInJFrame(Container content, int width, int height)
static JFrame openInJFrame(Container content, int width, int height, String title, Color bgColor)
static JFrame openInJFrame(Container content, int width, int height, String title)
int width
Definition: makedep.cpp:109