Methods Summary |
---|
public javax.swing.JPanel | createHorizontalPanel(boolean threeD)
JPanel p = new JPanel();
p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
p.setAlignmentY(TOP_ALIGNMENT);
p.setAlignmentX(LEFT_ALIGNMENT);
if(threeD) {
p.setBorder(loweredBorder);
}
return p;
|
public javax.swing.ImageIcon | createImageIcon(java.lang.String filename, java.lang.String description)
if(getSwingSet2() != null) {
return getSwingSet2().createImageIcon(filename, description);
} else {
String path = "/resources/images/" + filename;
return new ImageIcon(getClass().getResource(path), description);
}
|
public javax.swing.JPanel | createVerticalPanel(boolean threeD)
JPanel p = new JPanel();
p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS));
p.setAlignmentY(TOP_ALIGNMENT);
p.setAlignmentX(LEFT_ALIGNMENT);
if(threeD) {
p.setBorder(loweredBorder);
}
return p;
|
public javax.swing.JPanel | getDemoPanel()
return panel;
|
public javax.swing.Icon | getIcon()
return createImageIcon(iconPath, getResourceName() + ".name");
|
public char | getMnemonic(java.lang.String key)
return (getString(key)).charAt(0);
|
public java.lang.String | getName()
return getString(getResourceName() + ".name");
|
public java.lang.String | getResourceName()
return resourceName;
|
public java.lang.String | getSourceCode()
return sourceCode;
|
public java.lang.String | getString(java.lang.String key)
String value = "nada";
if(bundle == null) {
if(getSwingSet2() != null) {
bundle = getSwingSet2().getResourceBundle();
} else {
bundle = ResourceBundle.getBundle("resources.swingset");
}
}
try {
value = bundle.getString(key);
} catch (MissingResourceException e) {
System.out.println("java.util.MissingResourceException: Couldn't find value for: " + key);
}
return value;
|
public SwingSet2 | getSwingSet2()
return swingset;
|
public java.lang.String | getToolTip()
return getString(getResourceName() + ".tooltip");
|
public void | init()
getContentPane().setLayout(new BorderLayout());
getContentPane().add(getDemoPanel(), BorderLayout.CENTER);
|
public void | loadSourceCode()
if(getResourceName() != null) {
String filename = "src/" + getResourceName() + ".java";
sourceCode = new String("<html><pre>");
char[] buff = new char[50000];
InputStream is;
InputStreamReader isr;
CodeViewer cv = new CodeViewer();
URL url;
try {
url = getClass().getResource(filename);
is = url.openStream();
isr = new InputStreamReader(is);
BufferedReader reader = new BufferedReader(isr);
// Read one line at a time, htmlize using super-spiffy
// html java code formating utility from www.CoolServlets.com
String line = reader.readLine();
while(line != null) {
sourceCode += cv.syntaxHighlight(line) + " \n ";
line = reader.readLine();
}
sourceCode += new String("</pre></html>");
} catch (Exception ex) {
sourceCode = "Could not load file: " + filename;
}
}
|
public static void | main(java.lang.String[] args)
DemoModule demo = new DemoModule(null);
demo.mainImpl();
|
public void | mainImpl()
JFrame frame = new JFrame(getName());
frame.getContentPane().setLayout(new BorderLayout());
frame.getContentPane().add(getDemoPanel(), BorderLayout.CENTER);
getDemoPanel().setPreferredSize(new Dimension(PREFERRED_WIDTH, PREFERRED_HEIGHT));
frame.pack();
frame.show();
|