Posted by Àü´öÂù on August 11, 1997 at 09:39:08:
/* ¾È³çÇϼ¼¿ä. JISÀÇ Àü´õÂùÀÔ´Ï´Ù.
JFCÀÇ Swing0.3¹®¼¿¡ ÀÖ´Â °£´ÜÇÑ JFC¾ÖÇø®ÄÉÀ̼ÇÀÔ´Ï´Ù.
ÇöÀç·Î¼´Â º°·Î ¾Æ´Â¹Ù°¡ ¾ø¾î ±×³É ¿Ã¸³´Ï´Ù.
ÄÄÆÄÀÏ Çؼ ½ÇÇàÇØ º¸¼¼¿ä.
Á¦°¡ ½ÇÇàÇØ º¸´Ï ´ÙÀ½°ú °°ÀÌ ³ª¿À±º¿ä.
Basic¹öÆ°À» ´©¸£´Ï±î PanelÀÇ Å©±â°¡ ÃÖ¼ÒÇÑÀÇ Size·Î
µÇµ¹¾Æ ¿À´õ±º¿ä.
ÀÚ¹Ù SSPATH¼³Á¤ ÇؾßÇÒ °ÍµéÀÌ ¿ö³«ÀÌ ¸¹¾Æ Àß ¼³Á¤ÀÌ ¾ÈµÇ½Ã´Â ºÐµé
Swing0.3°ú ÀÚ¹Ù JDK, JDBC path, JDBC-ODBC, Mocha Decompiler path°¡
ÀüºÎ Á¦ Windows95¿¡ Autoexec.bat¿¡ ¼³Á¤µÇ¾î Àִµ¥
Ȥ½Ã Classpath¼³Á¤ Àß ¾ÈµÇ½Ã´Â ºÐµé General°Ô½ÃÆÇ¿¡ ±Û ¿Ã·ÁÁÖ¼¼¿ä.
¶ÇÇÑ ½ÇÇà½Ã not find classfile¿¡·¯ ³ª¿À½Ã´Â ºÐµµ ±ÛÀ» ¿Ã·ÁÁÖ¼¼¿ä.
±×·¯¸é ´äº¯À» ¹Ù·Î ¿Ã¸®°Ú½À´Ï´Ù. */
/* ¿¡ ´ëÇØ ´õ ¾Æ½Ã´Â ºÐ ±ÛÀ» ¿Ã·Á Áֽñ⠹ٶø´Ï´Ù. */
import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;
import com.sun.java.swing.*;
/**
* An application that displays a JButton and two JRadioButtons.
* The JRadioButtons determine the look and feel used by the application.
*/
public class SimpleExample extends JPanel {
static JFrame frame;
static String basic = new String("Basic");
static String rose = new String("Rose");
public SimpleExample() {
super(true);
// Create the buttons.
JButton button = new JButton("Hello, world");
button.setKeyAccelerator('h'); //for looks only; button does nada
JRadioButton basicButton = new JRadioButton(basic);
basicButton.setKeyAccelerator('b');
basicButton.setActionCommand(basic);
basicButton.setSelected(true);
JRadioButton roseButton = new JRadioButton(rose);
roseButton.setKeyAccelerator('r');
roseButton.setActionCommand(rose);
// Group the radio buttons.
ButtonGroup group = new ButtonGroup();
group.add(basicButton);
group.add(roseButton);
// Register a listener for the radio buttons.
RadioListener myListener = new RadioListener();
roseButton.addActionListener(myListener);
basicButton.addActionListener(myListener);
add(button);
add(basicButton);
add(roseButton);
}
/** An ActionListener that listens to the radio buttons. */
class RadioListener implements ActionListener {
public void actionPerformed(ActionEvent e) {
String factoryName = null;
if (e.getActionCommand() == rose) {
factoryName = "com.sun.java.swing.rose.RoseFactory";
} else {
factoryName = "com.sun.java.swing.basic.BasicFactory";
}
try {
UIManager.setUIFactory(factoryName, (Container)frame);
frame.pack();
} catch (ClassNotFoundException cnf) {
System.err.println("could not load factory: "
+ factoryName);
}
}
}
public static void main(String s[]) {
WindowListener l = new WindowAdapter() {
public void windowClosing(WindowEvent e) {System.exit(0);}
};
frame = new JFrame("SimpleExample");
frame.addWindowListener(l);
frame.add("Center", new SimpleExample());
frame.pack();
frame.setVisible(true);
}
}