AdminMain() { l = new JLabel(); l.setBounds(10, 20, 1340, 1000); l.setBackground(Color.black); Font ft = new Font("Arial", Font.BOLD, 30); Font ft1 = new Font("Arial", Font.BOLD, 14); Font ft2 = new Font("Arial", Font.BOLD, 20); f1 = new Frame("Soft Test Management (Beta)"); f1.setLayout(null); l1 = new Label("Test Instructions", l1.CENTER); l1.setBounds(10, 20, 1300, 60); l1.setForeground(Color.blue); l1.setBackground(Color.white); l1.setFont(ft); l2 = new JLabel("Deletion of Faculty/Students"); l2.setBounds(20, 30, 1000, 500); l2.setBackground(Color.blue); l2.setFont(ft2); l3 = new JLabel("Test Pattern"); l3.setBounds(20, 90, 1300, 500); l3.setBackground(Color.green); l3.setFont(ft2); b1 = new JButton("Go !"); b1.setBounds(300, 220, 120, 30); b1.setBackground(Color.white); b1.setForeground(Color.blue); b1.setFont(ft2); b2 = new JButton("Go"); b2.setBounds(300, 240, 120, 30); b2.setBackground(Color.white); b2.setForeground(Color.blue); b2.setFont(ft2); f1.add(l); l.add(l1); l2.add(b1); l.add(l2); l3.add(b2); l.add(l3); b1.addActionListener(this); b2.addActionListener(this); f1.setVisible(true); f1.setSize(1800, 800); }
public MapDesigner(int row, int col) { this.row = row; // 設置行數 this.col = col; // 設置列數 this.setTitle("3D迷宮重力球地圖設計器"); // 設置標題 icrystal = new ImageIcon("img/Diamond.png").getImage(); // 圓孔的標誌圖 mdp = new MapDesignPanel(row, col, this); // 創建地圖設計器面板 jsp = new JScrollPane(mdp); // 創建JScrollPane面板 this.add(jsp); // 添加JScrollPane面板 jp.add(jbGenerate); // 添加生成地圖按鈕 jp.add(jbGenerateD); // 添加生成圓孔按鈕 jp.add(jrBlack); bg.add(jrBlack); // 向jp中添加黑色單選按鈕 jp.add(jrWhite); bg.add(jrWhite); // 向jp中添加白色單選按鈕 jp.add(jrCrystal); bg.add(jrCrystal); // 向jp中添加圓孔單選按鈕 this.add(jp, BorderLayout.NORTH); // jp添加進窗體中 jbGenerate.addActionListener(this); // 生成地圖按鈕設置監聽 jbGenerateD.addActionListener(this); // 生成圓孔按鈕設置監聽 this.setBounds(10, 10, 800, 600); // 設置窗口大小 this.setVisible(true); // 設置可見 this.mdp.requestFocus(true); // MapDesignPanel獲取焦點 }
/** * Constrcutor. Draws the dialog. * * @param parent the parent frame for this dialog. * @param oColour the starting colour to select; */ public UIColorChooserDialog(JFrame parent, Color oColour) { super(parent, true); setTitle("Colour Chooser"); oParent = parent; tcc = new JColorChooser(oColour); oContentPane = getContentPane(); JPanel mainpanel = new JPanel(new BorderLayout()); mainpanel.setBorder(new EmptyBorder(10, 10, 10, 10)); mainpanel.add(tcc, BorderLayout.CENTER); JPanel buttonpanel = new JPanel(new FlowLayout(FlowLayout.CENTER)); // Add export button pbSave = new UIButton("Save"); pbSave.addActionListener(this); getRootPane().setDefaultButton(pbSave); buttonpanel.add(pbSave); // Add close button pbCancel = new UIButton("Cancel"); pbCancel.addActionListener(this); buttonpanel.add(pbCancel); mainpanel.add(buttonpanel, BorderLayout.SOUTH); oContentPane.add(mainpanel); pack(); }
/** Show the filter dialog */ public void showDialog() { empty_border = new EmptyBorder(5, 5, 0, 5); indent_border = new EmptyBorder(5, 25, 5, 5); include_panel = new ServiceFilterPanel("Include messages based on target service:", filter_include_list); exclude_panel = new ServiceFilterPanel("Exclude messages based on target service:", filter_exclude_list); status_box = new JCheckBox("Filter messages based on status:"); status_box.addActionListener(this); status_active = new JRadioButton("Active messages only"); status_active.setSelected(true); status_active.setEnabled(false); status_complete = new JRadioButton("Complete messages only"); status_complete.setEnabled(false); status_group = new ButtonGroup(); status_group.add(status_active); status_group.add(status_complete); if (filter_active || filter_complete) { status_box.setSelected(true); status_active.setEnabled(true); status_complete.setEnabled(true); if (filter_complete) { status_complete.setSelected(true); } } status_options = new JPanel(); status_options.setLayout(new BoxLayout(status_options, BoxLayout.Y_AXIS)); status_options.add(status_active); status_options.add(status_complete); status_options.setBorder(indent_border); status_panel = new JPanel(); status_panel.setLayout(new BorderLayout()); status_panel.add(status_box, BorderLayout.NORTH); status_panel.add(status_options, BorderLayout.CENTER); status_panel.setBorder(empty_border); ok_button = new JButton("Ok"); ok_button.addActionListener(this); cancel_button = new JButton("Cancel"); cancel_button.addActionListener(this); buttons = new JPanel(); buttons.setLayout(new FlowLayout()); buttons.add(ok_button); buttons.add(cancel_button); panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); panel.add(include_panel); panel.add(exclude_panel); panel.add(status_panel); panel.add(buttons); dialog = new JDialog(); dialog.setTitle("SOAP Monitor Filter"); dialog.setContentPane(panel); dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); dialog.setModal(true); dialog.pack(); Dimension d = dialog.getToolkit().getScreenSize(); dialog.setLocation((d.width - dialog.getWidth()) / 2, (d.height - dialog.getHeight()) / 2); ok_pressed = false; dialog.show(); }
public CreInvChecker(Component parent) { typeButtons = new JCheckBox[CHECKTYPES.length]; JPanel boxPanel = new JPanel(new GridLayout(0, 1)); for (int i = 0; i < typeButtons.length; i++) { typeButtons[i] = new JCheckBox(CHECKTYPES[i], true); boxPanel.add(typeButtons[i]); } bstart.setMnemonic('s'); bcancel.setMnemonic('c'); bstart.addActionListener(this); bcancel.addActionListener(this); selectframe.getRootPane().setDefaultButton(bstart); selectframe.setIconImage(Icons.getIcon("Find16.gif").getImage()); boxPanel.setBorder(BorderFactory.createTitledBorder("Select test to check:")); JPanel bpanel = new JPanel(new FlowLayout(FlowLayout.CENTER)); bpanel.add(bstart); bpanel.add(bcancel); JPanel mainpanel = new JPanel(new BorderLayout()); mainpanel.add(boxPanel, BorderLayout.CENTER); mainpanel.add(bpanel, BorderLayout.SOUTH); mainpanel.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3)); JPanel pane = (JPanel) selectframe.getContentPane(); pane.setLayout(new BorderLayout()); pane.add(mainpanel, BorderLayout.CENTER); selectframe.pack(); Center.center(selectframe, parent.getBounds()); selectframe.setVisible(true); }
private JComponent createActionsPanel() { final JButton include = new JButton(IdeBundle.message("button.include")); final JButton includeRec = new JButton(IdeBundle.message("button.include.recursively")); final JButton exclude = new JButton(IdeBundle.message("button.exclude")); final JButton excludeRec = new JButton(IdeBundle.message("button.exclude.recursively")); myPackageTree .getSelectionModel() .addTreeSelectionListener( new TreeSelectionListener() { @Override public void valueChanged(TreeSelectionEvent e) { final boolean recursiveEnabled = isButtonEnabled(true, e.getPaths(), e); includeRec.setEnabled(recursiveEnabled); excludeRec.setEnabled(recursiveEnabled); final boolean nonRecursiveEnabled = isButtonEnabled(false, e.getPaths(), e); include.setEnabled(nonRecursiveEnabled); exclude.setEnabled(nonRecursiveEnabled); } }); JPanel buttonsPanel = new JPanel(new VerticalFlowLayout()); buttonsPanel.add(include); buttonsPanel.add(includeRec); buttonsPanel.add(exclude); buttonsPanel.add(excludeRec); include.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { includeSelected(false); } }); includeRec.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { includeSelected(true); } }); exclude.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { excludeSelected(false); } }); excludeRec.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { excludeSelected(true); } }); return buttonsPanel; }
/** Constructor */ public ServiceFilterPanel(String text, Vector list) { empty_border = new EmptyBorder(5, 5, 0, 5); indent_border = new EmptyBorder(5, 25, 5, 5); service_box = new JCheckBox(text); service_box.addActionListener(this); service_data = new Vector(); if (list != null) { service_box.setSelected(true); service_data = (Vector) list.clone(); } service_list = new JList(service_data); service_list.setBorder(new EtchedBorder()); service_list.setVisibleRowCount(5); service_list.addListSelectionListener(this); service_list.setEnabled(service_box.isSelected()); service_scroll = new JScrollPane(service_list); service_scroll.setBorder(new EtchedBorder()); remove_service_button = new JButton("Remove"); remove_service_button.addActionListener(this); remove_service_button.setEnabled(false); remove_service_panel = new JPanel(); remove_service_panel.setLayout(new FlowLayout()); remove_service_panel.add(remove_service_button); service_area = new JPanel(); service_area.setLayout(new BorderLayout()); service_area.add(service_scroll, BorderLayout.CENTER); service_area.add(remove_service_panel, BorderLayout.EAST); service_area.setBorder(indent_border); add_service_field = new JTextField(); add_service_field.addActionListener(this); add_service_field.getDocument().addDocumentListener(this); add_service_field.setEnabled(service_box.isSelected()); add_service_button = new JButton("Add"); add_service_button.addActionListener(this); add_service_button.setEnabled(false); add_service_panel = new JPanel(); add_service_panel.setLayout(new BorderLayout()); JPanel dummy = new JPanel(); dummy.setBorder(empty_border); add_service_panel.add(dummy, BorderLayout.WEST); add_service_panel.add(add_service_button, BorderLayout.EAST); add_service_area = new JPanel(); add_service_area.setLayout(new BorderLayout()); add_service_area.add(add_service_field, BorderLayout.CENTER); add_service_area.add(add_service_panel, BorderLayout.EAST); add_service_area.setBorder(indent_border); setLayout(new BorderLayout()); add(service_box, BorderLayout.NORTH); add(service_area, BorderLayout.CENTER); add(add_service_area, BorderLayout.SOUTH); setBorder(empty_border); }
public TextFields() { t1.setDocument(ucd); ucd.addDocumentListener(new T1()); b1.addActionListener(new B1()); b2.addActionListener(new B2()); t1.addActionListener(new T1A()); setLayout(new FlowLayout()); add(b1); add(b2); add(t1); add(t2); add(t3); }
// {{{ init() method private void init() { EditBus.addToBus(this); /* Setup panes */ JPanel content = new JPanel(new BorderLayout(12, 12)); content.setBorder(new EmptyBorder(12, 12, 12, 12)); setContentPane(content); tabPane = new JTabbedPane(); tabPane.addTab(jEdit.getProperty("manage-plugins.title"), manager = new ManagePanel(this)); tabPane.addTab( jEdit.getProperty("update-plugins.title"), updater = new InstallPanel(this, true)); tabPane.addTab( jEdit.getProperty("install-plugins.title"), installer = new InstallPanel(this, false)); EditBus.addToBus(installer); content.add(BorderLayout.CENTER, tabPane); tabPane.addChangeListener(new ListUpdater()); /* Create the buttons */ Box buttons = new Box(BoxLayout.X_AXIS); ActionListener al = new ActionHandler(); mgrOptions = new JButton(jEdit.getProperty("plugin-manager.mgr-options")); mgrOptions.addActionListener(al); pluginOptions = new JButton(jEdit.getProperty("plugin-manager.plugin-options")); pluginOptions.addActionListener(al); done = new JButton(jEdit.getProperty("plugin-manager.done")); done.addActionListener(al); buttons.add(Box.createGlue()); buttons.add(mgrOptions); buttons.add(Box.createHorizontalStrut(6)); buttons.add(pluginOptions); buttons.add(Box.createHorizontalStrut(6)); buttons.add(done); buttons.add(Box.createGlue()); getRootPane().setDefaultButton(done); content.add(BorderLayout.SOUTH, buttons); setDefaultCloseOperation(DISPOSE_ON_CLOSE); setIconImage(GUIUtilities.getPluginIcon()); pack(); GUIUtilities.loadGeometry(this, parent, "plugin-manager"); GUIUtilities.addSizeSaver(this, parent, "plugin-manager"); setVisible(true); } // }}}
// Create the primary panel with sub panels. private void createMainPanel() { // Create the panels in each tab. JPanel capturePanel = createCapturePanel(); JPanel replayPanel = createReplayPanel(); // Create the tabs and add the new panels to them. JTabbedPane tabbedPane = new JTabbedPane(); tabbedPane.addTab("Capture", capturePanel); tabbedPane.addTab("Replay", replayPanel); // Create the buttons that always show to select app. JPanel topButtons = new JPanel(); topButtons.setLayout(new BoxLayout(topButtons, BoxLayout.X_AXIS)); JButton selectApp = new JButton("Select Application"); JLabel selectedApp = new JLabel("Selected App: "); appName = new JLabel(); topButtons.add(selectApp); topButtons.add(Box.createRigidArea(new Dimension(10, 0))); topButtons.add(selectedApp); topButtons.add(appName); selectApp.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent arg0) { displayAppFrame(); } }); // Add the buttons and tab structure. add(topButtons, BorderLayout.NORTH); add(tabbedPane, BorderLayout.CENTER); }
// Add JButton and JList components to the panel. public ScribblePane3() { // Implicit super() call here invokes the superclass constructor // Add a "Clear" button to the panel. // Handle button events with an action listener JButton clear = new JButton("Clear"); clear.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { clear(); } }); this.add(clear); // Add a JList to allow color choices. // Handle list selection events with a ListSelectionListener. final JList colorList = new JList(colorNames); colorList.addListSelectionListener( new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { setColor(colors[colorList.getSelectedIndex()]); } }); this.add(colorList); }
public ConstituentsPanel( DBInterface db, int _organizationID, int _constituentID, String _global_constituentID) { super(new BorderLayout()); MainFrame.status.addOrgStatusListener(this); // Application.orgs.addListener(this); if (_organizationID < 0) return; org_label.setText(getLabelText()); refresh_button.addActionListener(this); // refresh_button.setEnabled(false); disableRefresh(); add(getNorthComponent(), BorderLayout.NORTH); // _organizationID = 100; // _constituentID = 100; // String _global_constituentID = "global_ID_Test"; constituentID = _constituentID; organizationID = _organizationID; global_constituentID = _global_constituentID; D_Organization org = null; if (organizationID > 0) try { org = D_Organization.getOrgByLID_NoKeep(organizationID, true); } catch (Exception e) { e.printStackTrace(); return; } ConstituentsModel cm = new ConstituentsModel( db, _organizationID, _constituentID, _global_constituentID, org, this); tree = new ConstituentsTree(cm); long cID = cm.getConstituentIDMyself(); cm.expandConstituentID(tree, ((cID <= 0) ? null : ("" + cID)), true); JScrollPane scrollPane = new JScrollPane(tree); scrollPane.setPreferredSize(new Dimension(200, 200)); add(scrollPane, BorderLayout.CENTER); }
/* * The following method creates the color chooser dialog box */ public void createColorDialog() { colorDialog = new JDialog(this, new String("Choose a color"), true); colorDialog.getContentPane().add(createColorPicker(), BorderLayout.CENTER); JButton okButton = new JButton("OK"); // This class is used to create a special ActionListener for // the ok button class ButtonListener implements ActionListener { /* * This method is called whenever the ok button is clicked */ public void actionPerformed(ActionEvent event) { currentChoice.changeColor(color_panel.getColor()); currentChoice.repaint(); fontColor = color_panel.getColor(); colorDialog.hide(); } // end actionPerformed method } ActionListener listener = new ButtonListener(); okButton.addActionListener(listener); // Add the four font control panels to one big panel using // a grid layout JPanel buttonPanel = new JPanel(); buttonPanel.add(okButton); // Add the button panel to the content pane of the ColorDialogue colorDialog.getContentPane().add(buttonPanel, BorderLayout.SOUTH); colorDialog.pack(); }
/* * The following method creates the textfield to change the text * and the button to update the label. * postcondition: returns the panel containing the textfield and button. */ public JPanel createUpdateButton() { JLabel textLabel = new JLabel(new String("Change text to: ")); textField = new JTextField(new String("Big Java"), 20); textField.setFont(new Font(("Times"), Font.PLAIN, 12)); update = new JButton(new String("Update")); update.setDefaultCapable(true); // This class is used to create a special ActionListener for this menu item class ButtonListener implements ActionListener { /* * This method is called when the update button is clicked */ public void actionPerformed(ActionEvent event) { // Call the method to change the text on the screen. setSampleFont(); } // end actionPerformed method } ActionListener listener = new ButtonListener(); update.addActionListener(listener); JPanel panel = new JPanel(); panel.add(textLabel); panel.add(textField); panel.add(update); return panel; } // end createUpdateButton method
/** * Create a button to go inside of the toolbar. By default this will load an image resource. The * image filename is relative to the classpath (including the '.' directory if its a part of the * classpath), and may either be in a JAR file or a separate file. * * @param key The key in the resource file to serve as the basis of lookups. */ protected JButton createToolbarButton(String key) { URL url = getResource(key + imageSuffix); JButton b = new JButton(new ImageIcon(url)) { @Override public float getAlignmentY() { return 0.5f; } }; b.setRequestFocusEnabled(false); b.setMargin(new Insets(1, 1, 1, 1)); String astr = getProperty(key + actionSuffix); if (astr == null) { astr = key; } Action a = getAction(astr); if (a != null) { b.setActionCommand(astr); b.addActionListener(a); } else { b.setEnabled(false); } String tip = getResourceString(key + tipSuffix); if (tip != null) { b.setToolTipText(tip); } return b; }
public BatchInputPanel(final ImagePropertyTable imageTable) { super(new GridLayoutManager(3, 1, new Insets(0, 0, 0, 0), -1, -1)); this.imageTable = imageTable; setupUI(); useBatchInputCheckbox.addActionListener( new ActionListener() { public void actionPerformed(final ActionEvent event) { onBatch(); } }); applyToAllButton.addActionListener( new ActionListener() { public void actionPerformed(final ActionEvent event) { onApply(true); } }); applyToSelectedButton.addActionListener( new ActionListener() { public void actionPerformed(final ActionEvent event) { onApply(false); } }); orientationComboBox.addActionListener( new ActionListener() { public void actionPerformed(final ActionEvent event) { final boolean enableLabel = (orientationComboBox.getSelectedIndex() != 2 /* [Blank] */); orientationLabel.setEnabled(enableLabel); } }); lengthField .getDocument() .addDocumentListener(LabelEnablerFactory.create(lengthField, lengthLabel)); dpiXField.getDocument().addDocumentListener(LabelEnablerFactory.create(dpiXField, dpiXLabel)); dpiYField.getDocument().addDocumentListener(LabelEnablerFactory.create(dpiYField, dpiYLabel)); startDepthField .getDocument() .addDocumentListener(LabelEnablerFactory.create(startDepthField, startDepthLabel)); depthIncField .getDocument() .addDocumentListener(LabelEnablerFactory.create(depthIncField, depthIncLabel)); }
private JButton makeToolbarButton(String name, String toolTipText, String action) { // Create and initialize the button. JButton button = new JButton(makeImageIcon(name)); button.setToolTipText(toolTipText); button.setActionCommand(action); button.addActionListener(this); return button; }
public ListDemo() { super(new BorderLayout()); listModel = new DefaultListModel(); // Create the list and put it in a scroll pane. list = new JList(listModel); list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); list.setSelectedIndex(0); list.addListSelectionListener(this); list.setVisibleRowCount(5); JScrollPane listScrollPane = new JScrollPane(list); JButton hireButton = new JButton(hireString); HireListener hireListener = new HireListener(hireButton); hireButton.setActionCommand(hireString); hireButton.addActionListener(hireListener); hireButton.setEnabled(false); loadButton = new JButton(loadString); loadButton.setActionCommand(loadString); loadButton.addActionListener(new loadListener()); employeeName = new JTextField(10); employeeName.addActionListener(hireListener); employeeName.getDocument().addDocumentListener(hireListener); String name; if (listModel.size() > 0) { name = listModel.getElementAt(list.getSelectedIndex()).toString(); } // Create a panel that uses BoxLayout. JPanel buttonPane = new JPanel(); buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.LINE_AXIS)); buttonPane.add(loadButton); buttonPane.add(Box.createHorizontalStrut(5)); buttonPane.add(new JSeparator(SwingConstants.VERTICAL)); buttonPane.add(Box.createHorizontalStrut(5)); buttonPane.add(employeeName); buttonPane.add(hireButton); buttonPane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); add(listScrollPane, BorderLayout.CENTER); add(buttonPane, BorderLayout.PAGE_END); }
protected JButton createRunButton() { JButton run = new JButton("Run"); run.setEnabled(true); run.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { runSuite(); } }); return run; }
private JButton button() { JButton result = new JButton(((StudentSemesterPlan) _plan.getSemester(_year, _semester)).getTitle()); result.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { _planViewPanel.setSelectedSemester(_year, _semester); } }); return result; }
SaveControls(Grid currentGrid, ControlBar creator) { parent = creator; grid = currentGrid; super.setPreferredSize(new Dimension(200, 172)); setLayout(new GridLayout(3, 0)); fileName = new JTextField("SaveName"); save = new JButton("Save"); load = new JButton("Load"); save.addActionListener(this); load.addActionListener(this); super.add(fileName); super.add(save); super.add(load); super.repaint(); super.setVisible(true); }
/** * Constructor for FindDialog * * @param type * @param ta Description of the Parameter */ public FindDialog(JFrame parent, JTextComponent ta) { super(parent, "Find in Output", true); this.textarea = ta; textarea.requestFocus(); JPanel panel = new JPanel(); KappaLayout layout = new KappaLayout(); panel.setLayout(layout); panel.setBorder(new javax.swing.border.EmptyBorder(11, 11, 11, 11)); setContentPane(panel); JLabel find_label = new JLabel("Find:"); final JTextField to_find = new JTextField(20); JButton find_btn = new JButton("Find"); JButton find_next_btn = new JButton("Find Next"); JButton cancel_btn = new JButton("Close"); final JCheckBox wrap_cb = new JCheckBox("Wrap search"); wrap_cb.setSelected(true); panel.add(find_label, "0, 0, 1, 1, W, w, 3"); panel.add(to_find, "0, 1, 1, 1, 0, w, 3"); panel.add(wrap_cb, "0, 2, 1, 1, 0, w, 3"); JPanel btn_panel = new JPanel(new KappaLayout()); btn_panel.add(find_btn, "0, 0, 1, 1, 0, w, 3"); btn_panel.add(find_next_btn, "0, 1, 1, 1, 0, w, 3"); btn_panel.add(cancel_btn, "0, 2, 1, 1, 0, w, 3"); panel.add(btn_panel, "1, 0, 1, 3, 0, h, 5"); find_btn.addActionListener(new Finder(to_find, textarea, false, wrap_cb.isSelected())); find_next_btn.addActionListener(new Finder(to_find, textarea, true, wrap_cb.isSelected())); cancel_btn.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent ae) { setVisible(false); dispose(); } }); pack(); to_find.requestFocus(); }
protected void addMyControls() { // add browser-style control buttons JButton home = new JButton(new ImageIcon("data/Home24.gif")); JButton back = new JButton(new ImageIcon("data/Back24.gif")); JButton fwd = new JButton(new ImageIcon("data/Forward24.gif")); home.setToolTipText("Home"); home.addActionListener(this); home.setActionCommand(homeCmd); back.setToolTipText("Back"); back.addActionListener(this); back.setActionCommand(backCmd); back.setEnabled(false); // initially disabled fwd.setToolTipText("Forward"); fwd.addActionListener(this); fwd.setActionCommand(forwardCmd); fwd.setEnabled(false); // initially disabled add(home); add(back); add(fwd); add(new JToolBar.Separator()); // set built-in index variables homeIndex = getComponentIndex(home); backIndex = getComponentIndex(back); forwardIndex = getComponentIndex(fwd); JComboBox comboBox = new JComboBox(); comboBox.setEditable(true); comboBox.addActionListener(this); comboBox.setActionCommand(comboCmd); comboBox.setMaximumRowCount(3); // don't let it get too long comboBox.insertItemAt(mainBrowserURL, 0); // don't start it out empty add(comboBox); comboBoxIndex = getComponentIndex(comboBox); }
/** * Constructor. * * @param title the title of the tab component * @param editor the editor of the tab (used to close the tab) */ public TabComponent(final AbstractEditorPanel editor) { setLayout(new BorderLayout()); setBorder(BorderFactory.createEmptyBorder(3, 0, 0, 0)); setOpaque(false); // title title = new JLabel(editor.getTitle()); title.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5)); add(title, BorderLayout.WEST); // close final JButton close = new JButton(Project.getEditorImageIconOrEmpty("icon_cross.png")); close.setPreferredSize(new Dimension(16, 16)); close.setUI(new BasicButtonUI()); close.setBorderPainted(false); close.setOpaque(false); close.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { removeEditor(editor, true); } }); close.addMouseListener( new MouseListener() { @Override public void mouseClicked(MouseEvent me) {} @Override public void mousePressed(MouseEvent me) {} @Override public void mouseReleased(MouseEvent me) {} @Override public void mouseEntered(MouseEvent me) { close.setBorderPainted(true); } @Override public void mouseExited(MouseEvent me) { close.setBorderPainted(false); } }); add(close, BorderLayout.EAST); }
/* Post: sets up all the options visually */ public Options() { valuesArray = new ArrayList<Integer>(); populateRandomArray(); // size of the array enterSize = new JLabel("Array size:"); arraySizeEntry = new JTextField("", 3); arraySizeEntry.addActionListener(this); arraySizeEntry.getDocument().addDocumentListener(new DocListener()); // algorithm on top topAlgo = new JLabel("Top:"); String[] topAlgos = {"Selection Sort", "Insertion Sort", "Bubble Sort", "Merge Sort"}; chooseTopAlgo = new JComboBox(topAlgos); chooseTopAlgo.addActionListener(this); // algorithm on bottom bottomAlgo = new JLabel("Bottom:"); String[] bottomAlgos = {"Selection Sort", "Insertion Sort", "Bubble Sort", "Merge Sort"}; chooseBottomAlgo = new JComboBox(bottomAlgos); chooseBottomAlgo.addActionListener(this); // average case or worst case caseLabel = new JLabel("Choose case:"); String[] cases = {"Average Case", "Worst Case"}; chooseCase = new JComboBox(cases); chooseCase.addActionListener(this); // delay of comparisons in the visualizer enterSpeed = new JLabel("Delay:"); speedEntry = new JTextField("10", 2); speedEntry.addActionListener(this); speedEntry.getDocument().addDocumentListener(this); // run button (runs the visualizer) run = new JButton("Run"); run.addActionListener(this); // adding everything to the panel add(enterSize); add(arraySizeEntry); add(topAlgo); add(chooseTopAlgo); add(bottomAlgo); add(chooseBottomAlgo); add(caseLabel); add(chooseCase); add(enterSpeed); add(speedEntry); add(run); }
public PosDesktopBar(DesktopBar dBar, String dir) { super(); this.dBar = dBar; /*if (dir.equals(DesktopBar.NORTH) || dir.equals(DesktopBar.SOUTH)) setLayout(new GridLayout(2,2)); else*/ setLayout(new GridLayout(1, 4)); N = new buttonOrientation(DesktopBar.NORTH); N.addActionListener(this); S = new buttonOrientation(DesktopBar.SOUTH); S.addActionListener(this); W = new buttonOrientation(DesktopBar.WEST); W.addActionListener(this); E = new buttonOrientation(DesktopBar.EAST); E.addActionListener(this); add(N); add(S); add(W); add(E); }
public SelectServerDialog() { super(); setTitle("Select Server"); JLabel lblServer = new JLabel("IP or Name:"); txtServer = new JTextField(); txtServer.setMaximumSize(new Dimension(10000, 20)); Box boxServer = new Box(BoxLayout.X_AXIS); cmdConnect = new JButton("Connect"); cmdConnect.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) {} }); cmdCancel = new JButton("Cancel"); cmdCancel.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { dispose(); } }); }
protected void showFooter() { footerPanel = new JPanel(); submitButton = new JButton("Abschicken"); submitButton.setMnemonic(KeyEvent.VK_A); submitButton.addActionListener(this); submitButton.setEnabled(checkIfFormIsComplete()); footerPanel.add(submitButton); closeButton = new JButton("Schließen"); closeButton.setMnemonic(KeyEvent.VK_S); closeButton.addActionListener(this); closeButton.setEnabled(true); footerPanel.add(closeButton); allPanel.add(footerPanel); }
// Set up the quiz window Quiz() { initializeData(); setTitle("FOSS Quiz App"); setDefaultCloseOperation(EXIT_ON_CLOSE); setSize(440, 400); setLocation(300, 100); setResizable(true); Container cont = getContentPane(); cont.setLayout(null); cont.setBackground(Color.WHITE); bg = new ButtonGroup(); choice1 = new JRadioButton("Choice1", true); choice2 = new JRadioButton("Choice2", false); choice3 = new JRadioButton("Choice3", false); choice4 = new JRadioButton("Choice4", false); bg.add(choice1); bg.add(choice2); bg.add(choice3); bg.add(choice4); lblmess = new JLabel("Choose a correct anwswer"); lblmess.setForeground(Color.BLACK); lblmess.setFont(new Font("Sans_Serif", Font.BOLD, 15)); btnext = new JButton("Next"); btnext.setForeground(Color.WHITE); btnext.setFont(new Font("Sans_Serif", Font.BOLD, 17)); btnext.setBackground(Color.DARK_GRAY); btnext.addActionListener(this); panel = new JPanel(); panel.setBackground(Color.WHITE); panel.setLocation(10, 60); panel.setSize(400, 300); panel.setLayout(new GridLayout(0, 1)); title = new JPanel(); title.setBackground(Color.WHITE); title.setLocation(10, 10); title.setSize(1000, 50); title.setLayout(new GridLayout(1, 0)); title.add(lblmess); panel.add(choice1); panel.add(choice2); panel.add(choice3); panel.add(choice4); panel.add(btnext); cont.add(title); cont.add(panel); setVisible(true); quizAnswerID = 0; readQuestionAnswer(quizAnswerID); }
public FindSynonymsActionHandler(String word, int position, Chapter c, AbstractEditorPanel p) { this.word = word; this.position = position; // this.chapter = c; this.editorPanel = p; this.projectViewer = this.editorPanel.getViewer(); final FindSynonymsActionHandler _this = this; // Show a panel of all the items. this.popup = new QPopup( "Synonyms for: " + word, Environment.getIcon(Constants.FIND_ICON_NAME, Constants.ICON_POPUP), null); JButton close = UIUtils.createButton( Constants.CLOSE_ICON_NAME, Constants.ICON_MENU, "Click to close", null); List<JButton> buts = new ArrayList(); buts.add(close); this.popup.getHeader().setControls(UIUtils.createButtonBar(buts)); close.addActionListener( new ActionAdapter() { public void actionPerformed(ActionEvent ev) { _this.popup.setVisible(false); _this.editorPanel.getEditor().removeHighlight(_this.highlight); } }); p.addPopup(this.popup, true, true); /* this.highlight = this.editorPanel.getEditor ().addHighlight (position, position + word.length (), null, true); */ this.popup.setOpaque(false); this.popup.setVisible(false); this.popup.setDraggable(this.editorPanel); }