public void init(GUI gui) { m_gui = gui; // Create the display // width, height addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) { dispose(); } }); setSize(new Dimension(100, 100)); setBackground(Color.white); setFont(new Font("Helvetica", Font.PLAIN, 14)); GridBagLayout gridbag = new GridBagLayout(); setLayout(gridbag); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.BOTH; c.weightx = 1.0; recency = new TextField(Truline.userProps.getProperty("RecencyDays", "28"), 5); setRow(c, gridbag, new Label("Recency Days"), recency); maxdays = new TextField(Truline.userProps.getProperty("MaxDays", "120"), 5); setRow(c, gridbag, new Label("Max Days"), maxdays); maxvariant = new TextField(Truline.userProps.getProperty("MaxVariant", "25"), 5); setRow(c, gridbag, new Label("Max Variant"), maxvariant); maiden = new TextField(Truline.userProps.getProperty("UseMaiden", "Y"), 2); setRow(c, gridbag, new Label("Use Maiden"), maiden); betFactorVersion = new TextField(Truline.userProps.getProperty("BetFactorVersion", " "), 7); setRow(c, gridbag, new Label("Bet Factor Version"), betFactorVersion); datadir = new TextField(Truline.userProps.getProperty("DATADIR", "."), 40); setRow(c, gridbag, new Label("Data Directory"), datadir); fontsize = new TextField(Truline.userProps.getProperty("FontSize", "8"), 40); setRow(c, gridbag, new Label("Print Font Size (8,9,10)"), fontsize); printProgram = new TextField(Truline.userProps.getProperty("PrintProgram", "WordPad.exe /p"), 40); setRow(c, gridbag, new Label("Print program"), printProgram); // shell = new TextField(Truline.userProps.getProperty("Shell", "command"), // 40); // setRow(c, gridbag, new Label("Shell program"), shell); Panel panel1 = new Panel(); panel1.setLayout(new BorderLayout()); Button OKButton = new Button(" OK "); OKButton.setActionCommand("ok"); OKButton.addActionListener(this); panel1.add(OKButton, BorderLayout.CENTER); Panel panel2 = new Panel(); panel2.setLayout(new BorderLayout()); Button cancelButton = new Button("Cancel"); cancelButton.setActionCommand("cancel"); cancelButton.addActionListener(this); panel2.add(cancelButton, BorderLayout.CENTER); setRow(c, gridbag, panel2, panel1); pack(); show(); }
public CipherChatClient() { super("Cipher Chat Client"); // Establish keys for RSA cipher makeKeys(); // Lay out the components and display the frame setLayout(new GridLayout(2, 1)); top.setLayout(new GridLayout(3, 1)); add(top); bottom.setLayout(new GridLayout(1, 1)); add(bottom); connectButton.addActionListener(this); enterField.setEnabled(false); enterField.addActionListener(this); top.add(serverField); top.add(connectButton); top.add(enterField); bottom.add(displayArea); setSize(400, 300); show(); }
/* WARNING: THIS METHOD WILL BE REGENERATED. */ private java.awt.Panel getPanel1() { if (ivjPanel1 == null) { try { ivjPanel1 = new java.awt.Panel(); ivjPanel1.setName("Panel1"); ivjPanel1.setLayout(getPanel1FlowLayout()); getPanel1().add(getokButton(), getokButton().getName()); // user code begin {1} // user code end } catch (java.lang.Throwable ivjExc) { // user code begin {2} // user code end handleException(ivjExc); } } return ivjPanel1; }
/* WARNING: THIS METHOD WILL BE REGENERATED. */ private java.awt.Panel getContentsPane() { if (ivjContentsPane == null) { try { ivjContentsPane = new java.awt.Panel(); ivjContentsPane.setName("ContentsPane"); ivjContentsPane.setLayout(new java.awt.BorderLayout()); getContentsPane().add(getPanel1(), "South"); getContentsPane().add(getLabel1(), "North"); // user code begin {1} // user code end } catch (java.lang.Throwable ivjExc) { // user code begin {2} // user code end handleException(ivjExc); } } return ivjContentsPane; }
/* WARNING: THIS METHOD WILL BE REGENERATED. */ private java.awt.Panel getbutonPanel() { if (ivjbutonPanel == null) { try { ivjbutonPanel = new java.awt.Panel(); ivjbutonPanel.setName("butonPanel"); ivjbutonPanel.setLayout(new java.awt.FlowLayout()); getbutonPanel().add(getfindButton(), getfindButton().getName()); getbutonPanel().add(getaddButton(), getaddButton().getName()); // user code begin {1} // user code end } catch (java.lang.Throwable ivjExc) { // user code begin {2} // user code end handleException(ivjExc); } } return ivjbutonPanel; }
Board() { addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) { exit(); } }); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); setSize(screenSize); setLocation(0, 0); r3 = Math.sqrt(3); Button ng, eg, ab; ng = new Button("New Game"); eg = new Button("Exit Game"); ab = new Button("About"); gold = new ImageIcon("./coin2.jpg").getImage(); silver = new ImageIcon("./coin1.jpg").getImage(); Panel pan = new Panel(); pan.setLayout(new FlowLayout()); pan.add(ng); pan.add(eg); pan.add(ab); setLayout(new BorderLayout()); add(pan, BorderLayout.NORTH); newGame(); ng.addActionListener(this); eg.addActionListener(this); ab.addActionListener(this); addMouseListener( new MouseAdapter() { public void mouseClicked(MouseEvent e) { int mx = e.getX(), my = e.getY(); place(mx, my); } }); }
public babylonServerWindow(babylonServer parent, String Name) { super(Name); server = parent; myLayout = new GridBagLayout(); setLayout(myLayout); p = new Panel(); p.setLayout(myLayout); listening = new Label(server.strings.get(thisClass, "listenport") + " " + server.port); p.add( listening, new babylonConstraints( 0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); logChat = new Checkbox(server.strings.get(thisClass, "logchats"), server.logChats); logChat.addItemListener(this); p.add( logChat, new babylonConstraints( 1, 0, 1, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); userList = new List(4, false); userList.addItemListener(this); p.add( userList, new babylonConstraints( 0, 1, 1, 5, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, new Insets(0, 0, 5, 0), 0, 0)); userAdmin = new Button(server.strings.get(thisClass, "usermanagement")); userAdmin.addActionListener(this); p.add( userAdmin, new babylonConstraints( 1, 1, 1, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); console = new Button(server.strings.get(thisClass, "adminclient")); console.addActionListener(this); p.add( console, new babylonConstraints( 1, 2, 1, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); disconnect = new Button(server.strings.get(thisClass, "disconnectuser")); disconnect.setEnabled(false); disconnect.addActionListener(this); p.add( disconnect, new babylonConstraints( 1, 3, 1, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); disconnectAll = new Button(server.strings.get(thisClass, "disconnectall")); disconnectAll.setEnabled(false); disconnectAll.addActionListener(this); p.add( disconnectAll, new babylonConstraints( 1, 4, 1, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); shutdown = new Button(server.strings.get(thisClass, "shutdown")); shutdown.addActionListener(this); p.add( shutdown, new babylonConstraints( 1, 5, 1, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); stats = new TextField( server.strings.get(thisClass, "connectionscurrent") + " 0 " + server.strings.get(thisClass, "connectionspeak") + " 0 " + server.strings.get(thisClass, "connectionstotal") + " 0", 40); stats.setEditable(false); p.add( stats, new babylonConstraints( 0, 7, 2, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); logWindow = new TextArea( server.strings.get(thisClass, "activitylog") + "\n", 10, 40, TextArea.SCROLLBARS_VERTICAL_ONLY); logWindow.setEditable(false); p.add( logWindow, new babylonConstraints( 0, 8, 2, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, new Insets(0, 0, 5, 0), 0, 0)); canvas = new babylonPictureCanvas(this); p.add( canvas, new babylonConstraints( 0, 9, 2, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); add( p, new babylonConstraints( 0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0)); try { URL url = new URL("file", "localhost", "babylonPic.jpg"); Image image = getToolkit().getImage(url); canvas.setimage(image); } catch (Exception e) { System.out.println(e); } try { URL iconUrl = new URL("file", "localhost", "babylonIcon.jpg"); ImageIcon icon = new ImageIcon(iconUrl); this.setIconImage(icon.getImage()); } catch (Exception e) { /* Not important */ } addWindowListener(this); setSize(600, 600); pack(); }
public babylonServerShutdownDialog(babylonServerWindow serverWindow, babylonServer theServer) { super(serverWindow, theServer.strings.get(babylonServerWindow.class, "servershutdown"), true); parentWindow = serverWindow; server = theServer; myLayout = new GridBagLayout(); setLayout(myLayout); p = new Panel(); p.setLayout(myLayout); message1 = new Label(server.strings.get(babylonServerWindow.class, "areyousure1")); p.add( message1, new babylonConstraints( 0, 0, 2, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); message2 = new Label(server.strings.get(babylonServerWindow.class, "areyousure2")); p.add( message2, new babylonConstraints( 0, 1, 2, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); yes = new Button(server.strings.get(babylonServerWindow.class, "yes")); yes.addKeyListener(this); yes.addActionListener(this); p.add( yes, new babylonConstraints( 0, 2, 1, 1, 1.0, 1.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); cancel = new Button(server.strings.get("cancel")); cancel.addKeyListener(this); cancel.addActionListener(this); p.add( cancel, new babylonConstraints( 1, 2, 1, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); add( p, new babylonConstraints( 0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); setBackground(Color.lightGray); pack(); setResizable(false); parentWindow.centerDialog(this); addKeyListener(this); addWindowListener(this); setVisible(true); yes.requestFocus(); }
RecordingFrame(VncViewer v) { super("Teambox Screen Sharing Session Recording"); viewer = v; // Determine initial filename for next saved session. // FIXME: Check SecurityManager. String fname = nextNewFilename( System.getProperty("user.dir") + System.getProperty("file.separator") + "vncsession.fbs"); // Construct new panel with file name field and "Browse" button. Panel fnamePanel = new Panel(); GridBagLayout fnameGridbag = new GridBagLayout(); fnamePanel.setLayout(fnameGridbag); GridBagConstraints fnameConstraints = new GridBagConstraints(); fnameConstraints.gridwidth = GridBagConstraints.RELATIVE; fnameConstraints.fill = GridBagConstraints.BOTH; fnameConstraints.weightx = 4.0; fnameField = new TextField(fname, 64); fnameGridbag.setConstraints(fnameField, fnameConstraints); fnamePanel.add(fnameField); fnameField.addActionListener(this); fnameConstraints.gridwidth = GridBagConstraints.REMAINDER; fnameConstraints.weightx = 1.0; browseButton = new Button("Browse"); fnameGridbag.setConstraints(browseButton, fnameConstraints); fnamePanel.add(browseButton); browseButton.addActionListener(this); // Construct the frame. GridBagLayout gridbag = new GridBagLayout(); setLayout(gridbag); GridBagConstraints gbc = new GridBagConstraints(); gbc.gridwidth = GridBagConstraints.REMAINDER; gbc.fill = GridBagConstraints.BOTH; gbc.weighty = 1.0; gbc.insets = new Insets(10, 0, 0, 0); Label helpLabel = new Label("File name to save next recorded session in:", Label.CENTER); gridbag.setConstraints(helpLabel, gbc); add(helpLabel); gbc.fill = GridBagConstraints.HORIZONTAL; gbc.weighty = 0.0; gbc.insets = new Insets(0, 0, 0, 0); gridbag.setConstraints(fnamePanel, gbc); add(fnamePanel); gbc.fill = GridBagConstraints.BOTH; gbc.weighty = 1.0; gbc.insets = new Insets(10, 0, 10, 0); statusLabel = new Label("", Label.CENTER); gridbag.setConstraints(statusLabel, gbc); add(statusLabel); gbc.fill = GridBagConstraints.HORIZONTAL; gbc.weightx = 1.0; gbc.weighty = 0.0; gbc.gridwidth = 1; gbc.insets = new Insets(0, 0, 0, 0); recordButton = new Button("Record"); gridbag.setConstraints(recordButton, gbc); add(recordButton); recordButton.addActionListener(this); nextButton = new Button("Next file"); gridbag.setConstraints(nextButton, gbc); add(nextButton); nextButton.addActionListener(this); closeButton = new Button("Close"); gridbag.setConstraints(closeButton, gbc); add(closeButton); closeButton.addActionListener(this); // Set correct text, font and color for the statusLabel. stopRecording(); pack(); addWindowListener(this); }
/** * If 'applet' is not null, creates a new ImageJ frame that runs as an applet. If 'mode' is * ImageJ.EMBEDDED and 'applet is null, creates an embedded (non-standalone) version of ImageJ. */ public ImageJ(java.applet.Applet applet, int mode) { super("ImageJ"); if ((mode & DEBUG) != 0) IJ.setDebugMode(true); mode = mode & 255; if (IJ.debugMode) IJ.log("ImageJ starting in debug mode: " + mode); embedded = applet == null && (mode == EMBEDDED || mode == NO_SHOW); this.applet = applet; String err1 = Prefs.load(this, applet); setBackground(backgroundColor); Menus m = new Menus(this, applet); String err2 = m.addMenuBar(); m.installPopupMenu(this); setLayout(new BorderLayout()); // Tool bar toolbar = new Toolbar(); toolbar.addKeyListener(this); add("Center", toolbar); // Status bar statusBar = new Panel(); statusBar.setLayout(new BorderLayout()); statusBar.setForeground(Color.black); statusBar.setBackground(backgroundColor); statusLine = new JLabel(); statusLine.setFont(new Font("SansSerif", Font.PLAIN, 13)); statusLine.addKeyListener(this); statusLine.addMouseListener(this); statusBar.add("Center", statusLine); progressBar = new ProgressBar(120, 20); progressBar.addKeyListener(this); progressBar.addMouseListener(this); statusBar.add("East", progressBar); add("South", statusBar); IJ.init(this, applet); addKeyListener(this); addWindowListener(this); setFocusTraversalKeysEnabled(false); m.installStartupMacroSet(); // add custom tools runStartupMacro(); Point loc = getPreferredLocation(); Dimension tbSize = toolbar.getPreferredSize(); setCursor(Cursor.getDefaultCursor()); // work-around for JDK 1.1.8 bug if (mode != NO_SHOW) { if (IJ.isWindows()) try { setIcon(); } catch (Exception e) { } setLocation(loc.x, loc.y); setResizable(!IJ.isMacOSX()); pack(); setVisible(true); } if (err1 != null) IJ.error(err1); if (err2 != null) { IJ.error(err2); IJ.runPlugIn("ij.plugin.ClassChecker", ""); } if (IJ.isMacintosh() && applet == null) { Object qh = null; qh = IJ.runPlugIn("MacAdapter", ""); if (qh == null) IJ.runPlugIn("QuitHandler", ""); } if (applet == null) IJ.runPlugIn("ij.plugin.DragAndDrop", ""); String str = m.getMacroCount() == 1 ? " macro" : " macros"; IJ.showStatus(version() + m.getPluginCount() + " commands; " + m.getMacroCount() + str); configureProxy(); if (applet == null) loadCursors(); }
/** * If 'applet' is not null, creates a new ImageJ frame that runs as an applet. If 'mode' is * ImageJ.EMBEDDED and 'applet is null, creates an embedded (non-standalone) version of ImageJ. */ public ImageJ(java.applet.Applet applet, int mode) { super("ImageJ"); embedded = applet == null && (mode == EMBEDDED || mode == NO_SHOW); this.applet = applet; String err1 = Prefs.load(this, applet); if (IJ.isLinux()) { backgroundColor = new Color(240, 240, 240); setBackground(backgroundColor); } Menus m = new Menus(this, applet); String err2 = m.addMenuBar(); m.installPopupMenu(this); setLayout(new GridLayout(2, 1)); // Tool bar toolbar = new Toolbar(); toolbar.addKeyListener(this); add(toolbar); // Status bar statusBar = new Panel(); statusBar.setLayout(new BorderLayout()); statusBar.setForeground(Color.black); statusBar.setBackground(backgroundColor); statusLine = new Label(); statusLine.setFont(SansSerif12); statusLine.addKeyListener(this); statusLine.addMouseListener(this); statusBar.add("Center", statusLine); progressBar = new ProgressBar(120, 20); progressBar.addKeyListener(this); progressBar.addMouseListener(this); statusBar.add("East", progressBar); statusBar.setSize(toolbar.getPreferredSize()); add(statusBar); IJ.init(this, applet); addKeyListener(this); addWindowListener(this); setFocusTraversalKeysEnabled(false); Point loc = getPreferredLocation(); Dimension tbSize = toolbar.getPreferredSize(); int ijWidth = tbSize.width + 10; int ijHeight = 100; setCursor(Cursor.getDefaultCursor()); // work-around for JDK 1.1.8 bug if (mode != NO_SHOW) { if (IJ.isWindows()) try { setIcon(); } catch (Exception e) { } setBounds(loc.x, loc.y, ijWidth, ijHeight); // needed for pack to work setLocation(loc.x, loc.y); pack(); setResizable(!(IJ.isMacintosh() || IJ.isWindows())); // make resizable on Linux show(); } if (err1 != null) IJ.error(err1); if (err2 != null) { IJ.error(err2); IJ.runPlugIn("ij.plugin.ClassChecker", ""); } m.installStartupMacroSet(); if (IJ.isMacintosh() && applet == null) { Object qh = null; qh = IJ.runPlugIn("MacAdapter", ""); if (qh == null) IJ.runPlugIn("QuitHandler", ""); } if (applet == null) IJ.runPlugIn("ij.plugin.DragAndDrop", ""); String str = m.getMacroCount() == 1 ? " macro" : " macros"; IJ.showStatus(version() + m.getPluginCount() + " commands; " + m.getMacroCount() + str); // if (applet==null && !embedded && Prefs.runSocketListener) // new SocketListener(); configureProxy(); if (applet == null) loadCursors(); }