protected void initComponents() { int border = 2; this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); this.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); // Description label JPanel descriptionPanel = new JPanel(new GridLayout(0, 1, 0, 0)); descriptionPanel.setBorder(BorderFactory.createEmptyBorder(border, border, border, border)); String text = thread.getRetrievable().getName(); text = text.length() > 40 ? text.substring(0, 37) + "..." : text; descriptionLabel = new JLabel(text); descriptionPanel.add(descriptionLabel); this.add(descriptionPanel); // Progrees and cancel button JPanel progressPanel = new JPanel(); progressPanel.setLayout(new BoxLayout(progressPanel, BoxLayout.X_AXIS)); progressPanel.setBorder(BorderFactory.createEmptyBorder(border, border, border, border)); progressBar = new JProgressBar(0, 100); progressBar.setPreferredSize(new Dimension(100, 16)); progressPanel.add(progressBar); progressPanel.add(Box.createHorizontalStrut(8)); cancelButton = new JButton("Cancel"); cancelButton.setBackground(Color.RED); cancelButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent event) { cancelButtonActionPerformed(event); } }); progressPanel.add(cancelButton); this.add(progressPanel); }
public UserPasswordDialog(String title) { super(new JFrame(), title); getContentPane().setLayout(new BorderLayout()); JPanel userPanel = new JPanel(); userPanel.setLayout(new BorderLayout()); userPanel.setBorder(new EmptyBorder(10, 10, 10, 10)); userPanel.add("West", userLabel); userPanel.add("Center", userField); JPanel passwordPanel = new JPanel(); passwordPanel.setLayout(new BorderLayout()); passwordPanel.setBorder(new EmptyBorder(10, 10, 10, 10)); passwordPanel.add("West", passwordLabel); passwordPanel.add("Center", passwordField); JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new BorderLayout()); buttonPanel.setBorder(new EmptyBorder(10, 10, 10, 10)); buttonPanel.add("West", okButton); buttonPanel.add("East", cancelButton); okButton.addActionListener(this); cancelButton.addActionListener(this); getContentPane().add("North", userPanel); getContentPane().add("Center", passwordPanel); getContentPane().add("South", buttonPanel); pack(); }
public AboutDialog(View view) { super(view, jEdit.getProperty("about.title"), true); JPanel content = new JPanel(new BorderLayout()); content.setBorder(new EmptyBorder(12, 12, 12, 12)); setContentPane(content); content.add(BorderLayout.CENTER, new AboutPanel()); JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS)); buttonPanel.setBorder(new EmptyBorder(12, 0, 0, 0)); buttonPanel.add(Box.createGlue()); close = new JButton(jEdit.getProperty("common.close")); close.addActionListener(new ActionHandler()); getRootPane().setDefaultButton(close); buttonPanel.add(close); buttonPanel.add(Box.createGlue()); content.add(BorderLayout.SOUTH, buttonPanel); pack(); setResizable(false); setLocationRelativeTo(view); show(); }
/** 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(); }
/** * Component initialization. * * @throws java.lang.Exception */ private void jbInit() throws Exception { image1 = new ImageIcon(pt.inescporto.siasoft.MenuFrame.class.getResource("about.png")); imageLabel.setIcon(image1); setTitle("About"); panel1.setLayout(borderLayout1); panel2.setLayout(borderLayout2); insetsPanel1.setLayout(flowLayout1); insetsPanel2.setLayout(flowLayout1); insetsPanel2.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); gridLayout1.setRows(4); gridLayout1.setColumns(1); label1.setText(product); label2.setText(version); label3.setText(copyright); label4.setText(comments); insetsPanel3.setLayout(gridLayout1); insetsPanel3.setBorder(BorderFactory.createEmptyBorder(10, 60, 10, 10)); button1.setText("OK"); button1.addActionListener(this); insetsPanel2.add(imageLabel, null); panel2.add(insetsPanel2, BorderLayout.WEST); getContentPane().add(panel1, null); insetsPanel3.add(label1, null); insetsPanel3.add(label2, null); insetsPanel3.add(label3, null); insetsPanel3.add(label4, null); panel2.add(insetsPanel3, BorderLayout.CENTER); insetsPanel1.add(button1, null); panel1.add(insetsPanel1, BorderLayout.SOUTH); panel1.add(panel2, BorderLayout.NORTH); setResizable(true); }
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 void initComponents() { jfxPanel = new JFXPanel(); createScene(); ActionListener al = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { loadURL(txtURL.getText()); } }; btnGo.addActionListener(al); txtURL.addActionListener(al); progressBar.setPreferredSize(new Dimension(150, 18)); progressBar.setStringPainted(true); JPanel topBar = new JPanel(new BorderLayout(5, 0)); topBar.setBorder(BorderFactory.createEmptyBorder(3, 5, 3, 5)); topBar.add(txtURL, BorderLayout.CENTER); topBar.add(btnGo, BorderLayout.EAST); JPanel statusBar = new JPanel(new BorderLayout(5, 0)); statusBar.setBorder(BorderFactory.createEmptyBorder(3, 5, 3, 5)); statusBar.add(lblStatus, BorderLayout.CENTER); statusBar.add(progressBar, BorderLayout.EAST); panel.add(topBar, BorderLayout.NORTH); panel.add(jfxPanel, BorderLayout.CENTER); panel.add(statusBar, BorderLayout.SOUTH); frame.getContentPane().add(panel); }
public CopyFileToTable() { JPanel jPane1 = new JPanel(); jPane1.setLayout(new BorderLayout()); jPane1.add(new JLabel("Filename"), BorderLayout.WEST); jPane1.add(jbtViewFile, BorderLayout.EAST); jPane1.add(jtfFilename, BorderLayout.CENTER); JPanel jPane2 = new JPanel(); jPane2.setLayout(new BorderLayout()); jPane2.setBorder(new TitledBorder("Source Text File")); jPane2.add(jPane1, BorderLayout.NORTH); jPane2.add(new JScrollPane(jtaFile), BorderLayout.CENTER); JPanel jPane3 = new JPanel(); jPane3.setLayout(new GridLayout(5, 0)); jPane3.add(new JLabel("JDBC Driver")); jPane3.add(new JLabel("Database URL")); jPane3.add(new JLabel("Username")); jPane3.add(new JLabel("Password")); jPane3.add(new JLabel("Table Name")); JPanel jPane4 = new JPanel(); jPane4.setLayout(new GridLayout(5, 0)); jcboDriver.setEditable(true); jPane4.add(jcboDriver); jcboURL.setEditable(true); jPane4.add(jcboURL); jPane4.add(jtfUsername); jPane4.add(jtfPassword); jPane4.add(jtfTableName); JPanel jPane5 = new JPanel(); jPane5.setLayout(new BorderLayout()); jPane5.setBorder(new TitledBorder("Target Database Table")); jPane5.add(jbtCopy, BorderLayout.SOUTH); jPane5.add(jPane3, BorderLayout.WEST); jPane5.add(jPane4, BorderLayout.CENTER); add(jlblStatus, BorderLayout.SOUTH); add(new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, jPane2, jPane5), BorderLayout.CENTER); jbtViewFile.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent evt) { showFile(); } }); jbtCopy.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent evt) { try { copyFile(); } catch (Exception ex) { jlblStatus.setText(ex.toString()); } } }); }
public AddNewStudent() // constructor { // initializing buttons btnok = new JButton("OK"); btnok.addActionListener(this); btnexit = new JButton("Exit"); btnexit.addActionListener(this); btnaddnew = new JButton("AddNew"); btnaddnew.addActionListener(this); // initializing textfields tf1 = new JTextField(12); tf2 = new JTextField(12); // initializing labels lblname = new JLabel("Name:"); lbladd = new JLabel("Address:"); lblmsg = new JLabel("", JLabel.CENTER); // initializing panels p1 = new JPanel(); p2 = new JPanel(); p3 = new JPanel(); psouth = new JPanel(); // adding buttons and label to panel p1 // setting flowlayout p1.setLayout(new FlowLayout()); p1.add(btnok); p1.add(btnexit); p1.add(btnaddnew); // adding lblmsg to panel p3 p3.add(lblmsg); // adding both the panels to new panel,psouth // settin layout 2:1 psouth.setLayout(new GridLayout(2, 1)); psouth.add(p3); psouth.add(p1); // adding label and textfields to panel p2 p2.setLayout(new GridLayout(3, 1)); // setting line and titled border for panel p2 p2.setBorder(BorderFactory.createLineBorder(Color.red)); p2.setBorder(BorderFactory.createTitledBorder("Enter Your Details")); p2.add(lblname); p2.add(tf1); p2.add(lbladd); p2.add(tf2); // adding panel to container this.getContentPane().add(p2, "Center"); this.getContentPane().add(psouth, "South"); this.setSize(300, 300); this.setLocation(100, 200); this.show(); }
public void setOrientation(int o) { orientation = o; panel.setLayout(new BoxLayout(panel, orientation)); if (isHorisontal()) { panel.setBorder(BorderFactory.createEmptyBorder(9, 0, 0, 0)); } else { panel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); } }
public void kosmetika() { setTitle("Knygų sąrašų demo - KTU IF 2012"); panKnygųSar.setBorder(new TitledBorder("Visų knygų ir atrinktų knygų sąrašai")); panKnygųSar.setBackground(Color.lightGray); panDuomenys.setBorder(new TitledBorder("Knygų duomenys")); panDuomenys.setBackground(Color.lightGray); panAsmensDuo.setBackground(Color.white); panRez.setBackground(Color.white); panMygt.setBackground(Color.white); }
public void kosmetika() { setTitle("Automobilių sąrašų demo - KTU IF 2010"); panAutoSąr.setBorder(new TitledBorder("Visų automobilių ir atrinktų automobilių sąrašai")); panAutoSąr.setBackground(Color.yellow); panDuomenys.setBorder(new TitledBorder("Automobilių duomenys")); panDuomenys.setBackground(Color.lightGray); panAsmensDuo.setBackground(Color.green); panRez.setBackground(Color.gray); panMygt.setBackground(Color.magenta); }
public AppFrame() { // Create the WorldWindow. this.wwjPanel = new ApplicationTemplate.AppPanel(this.canvasSize, true); this.wwjPanel.setPreferredSize(canvasSize); ApplicationTemplate.insertBeforePlacenames(this.wwjPanel.getWwd(), layer); JPanel shapesPanel = makeShapeSelectionPanel(); shapesPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); JPanel attrsPanel = makeAttributesPanel(); attrsPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); // Put the pieces together. JPanel controlPanel = new JPanel(new BorderLayout()); controlPanel.add(shapesPanel, BorderLayout.CENTER); JPanel p = new JPanel(new BorderLayout(6, 6)); p.add(attrsPanel, BorderLayout.CENTER); controlPanel.add(p, BorderLayout.SOUTH); this.getContentPane().add(wwjPanel, BorderLayout.CENTER); this.getContentPane().add(controlPanel, BorderLayout.WEST); this.pack(); // Center the application on the screen. Dimension prefSize = this.getPreferredSize(); Dimension parentSize; java.awt.Point parentLocation = new java.awt.Point(0, 0); parentSize = Toolkit.getDefaultToolkit().getScreenSize(); int x = parentLocation.x + (parentSize.width - prefSize.width) / 2; int y = parentLocation.y + (parentSize.height - prefSize.height) / 2; this.setLocation(x, y); this.setResizable(true); wwjPanel .getWwd() .addRenderingListener( new RenderingListener() { public void stageChanged(RenderingEvent event) { if (!event.getStage().equals(RenderingEvent.BEFORE_BUFFER_SWAP)) return; if (currentShape instanceof Polyline) { Polyline p = (Polyline) currentShape; String length = Double.toString(p.getLength()); textRenderer.beginRendering(wwjPanel.getWidth(), wwjPanel.getHeight()); textRenderer.draw(length, 100, 100); textRenderer.endRendering(); } } }); // Enable dragging and other selection responses this.setupSelection(); }
public MainFrame() { try { mainPanel.setLayout(new BorderLayout()); mainPanel.setBorder(BorderFactory.createEmptyBorder(9, 9, 9, 9)); mainPanel.add(outputContainer, java.awt.BorderLayout.CENTER); outputArea.setLineWrap(true); outputContainer.add(new JScrollPane(outputArea), java.awt.BorderLayout.CENTER); outputContainer.setBorder(new javax.swing.border.TitledBorder("Results")); this.getContentPane().add(mainPanel, java.awt.BorderLayout.CENTER); java.util.ArrayList<JButton> btns = new java.util.ArrayList<JButton>(); { JPanel westPanel = new JPanel(new GridLayout(0, 1, 0, 10)); westPanel.setBorder(BorderFactory.createEmptyBorder(9, 9, 9, 9)); JPanel opsPanel = new JPanel(new GridLayout(6, 1)); opsPanel.setBorder(new javax.swing.border.TitledBorder("Operations")); for (Action action : operations) { JPanel p = new JPanel(new BorderLayout()); JButton jb = new JButton(action); btns.add(jb); p.add(jb, BorderLayout.NORTH); opsPanel.add(p); } westPanel.add(opsPanel); controlContainer.add(westPanel, BorderLayout.CENTER); } this.getContentPane().add(controlContainer, BorderLayout.WEST); this.pack(); Dimension dim = btns.get(0).getSize(); for (JButton btn : btns) { btn.setPreferredSize(dim); } java.awt.Dimension prefSize = this.getPreferredSize(); prefSize.setSize(prefSize.getWidth(), 1.1 * prefSize.getHeight()); this.setSize(prefSize); java.awt.Dimension parentSize; java.awt.Point parentLocation = new java.awt.Point(0, 0); parentSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize(); int x = parentLocation.x + (parentSize.width - prefSize.width) / 2; int y = parentLocation.y + (parentSize.height - prefSize.height) / 2; this.setLocation(x, y); this.setResizable(true); } catch (Exception e) { e.printStackTrace(); } }
private void kosmetika() { setTitle("Automobilių Queue ir Map struktūrų demo - KTU IF 2010"); panAutoSąr.setBorder( new TitledBorder( "Neregistruotų automobilių eilė ir " + "registruotų automobilių Map struktūra")); panAutoSąr.setBackground(Color.yellow); panDuomenys.setBorder(new TitledBorder("Registracijos duomenys ir veiksmai")); panDuomenys.setBackground(Color.lightGray); panRegNumeris.setBackground(Color.green); panRez.setBackground(Color.gray); panMygt.setBackground(Color.magenta); }
/** 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); }
ThreadHeaderRenderer(int modelCol) { super(modelCol); sort = new JPanel(new BorderLayout()); sort.setBorder(new BevelBorder(BevelBorder.RAISED)); sort.add(new JLabel(threadSortIcon), BorderLayout.CENTER); unsort = new JPanel(new BorderLayout()); unsort.setBorder(new BevelBorder(BevelBorder.RAISED)); unsort.add(new JLabel(threadUnSortIcon), BorderLayout.CENTER); comp = unsort; }
private JComponent createActionPanel() { JPanel actions = new NonOpaquePanel(); actions.setBorder(JBUI.Borders.emptyLeft(10)); actions.setLayout(new BoxLayout(actions, BoxLayout.Y_AXIS)); ActionManager actionManager = ActionManager.getInstance(); ActionGroup quickStart = (ActionGroup) actionManager.getAction(IdeActions.GROUP_WELCOME_SCREEN_QUICKSTART); DefaultActionGroup group = new DefaultActionGroup(); collectAllActions(group, quickStart); for (AnAction action : group.getChildren(null)) { JPanel button = new JPanel(new BorderLayout()); button.setOpaque(false); button.setBorder(JBUI.Borders.empty(8, 20)); AnActionEvent e = AnActionEvent.createFromAnAction( action, null, ActionPlaces.WELCOME_SCREEN, DataManager.getInstance().getDataContext(this)); action.update(e); Presentation presentation = e.getPresentation(); if (presentation.isVisible()) { String text = presentation.getText(); if (text != null && text.endsWith("...")) { text = text.substring(0, text.length() - 3); } Icon icon = presentation.getIcon(); if (icon.getIconHeight() != JBUI.scale(16) || icon.getIconWidth() != JBUI.scale(16)) { icon = JBUI.emptyIcon(16); } action = wrapGroups(action); ActionLink link = new ActionLink(text, icon, action, createUsageTracker(action)); link.setPaintUnderline(false); link.setNormalColor(getLinkNormalColor()); button.add(link); if (action instanceof WelcomePopupAction) { button.add(createArrow(link), BorderLayout.EAST); } installFocusable(button, action, KeyEvent.VK_UP, KeyEvent.VK_DOWN, true); actions.add(button); } } WelcomeScreenActionsPanel panel = new WelcomeScreenActionsPanel(); panel.actions.add(actions); return panel.root; }
private JComponent createSettingsPanel() { JPanel result = new JPanel(new FlowLayout(FlowLayout.RIGHT, 3, 0)); result.add(new JLabel(ApplicationBundle.message("label.font.size"))); myFontSizeSlider = new JSlider(JSlider.HORIZONTAL, 0, FontSize.values().length - 1, 3); myFontSizeSlider.setMinorTickSpacing(1); myFontSizeSlider.setPaintTicks(true); myFontSizeSlider.setPaintTrack(true); myFontSizeSlider.setSnapToTicks(true); UIUtil.setSliderIsFilled(myFontSizeSlider, true); result.add(myFontSizeSlider); result.setBorder(BorderFactory.createLineBorder(UIUtil.getBorderColor(), 1)); myFontSizeSlider.addChangeListener( new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { if (myIgnoreFontSizeSliderChange) { return; } EditorColorsManager colorsManager = EditorColorsManager.getInstance(); EditorColorsScheme scheme = colorsManager.getGlobalScheme(); scheme.setQuickDocFontSize(FontSize.values()[myFontSizeSlider.getValue()]); applyFontSize(); } }); String tooltipText = ApplicationBundle.message("quickdoc.tooltip.font.size.by.wheel"); result.setToolTipText(tooltipText); myFontSizeSlider.setToolTipText(tooltipText); result.setVisible(false); result.setOpaque(true); myFontSizeSlider.setOpaque(true); return result; }
public TestSwingExample1() { super("ActionExample"); setChannel(currentChannel); // enable/disable the Actions as appropriate channelLabel.setHorizontalAlignment(JLabel.CENTER); channelLabel.setFont(new Font("Serif", Font.PLAIN, 32)); getContentPane().add(channelLabel, BorderLayout.NORTH); JPanel buttonPanel = new JPanel(new GridLayout(2, 2, 16, 6)); buttonPanel.setBorder(BorderFactory.createEmptyBorder(6, 16, 16, 16)); getContentPane().add(buttonPanel, BorderLayout.CENTER); buttonPanel.add(new JButton(upAction)); buttonPanel.add(new JButton(gotoFavoriteAction)); buttonPanel.add(new JButton(downAction)); buttonPanel.add(new JButton(setFavoriteAction)); JMenuBar mb = new JMenuBar(); JMenu menu = new JMenu("Channel"); menu.add(new JMenuItem(upAction)); menu.add(new JMenuItem(downAction)); menu.addSeparator(); menu.add(new JMenuItem(gotoFavoriteAction)); menu.add(new JMenuItem(setFavoriteAction)); mb.add(menu); setJMenuBar(mb); }
/** Used to find the global attributes that another inspector has set so I can share it. */ ChartGenerator chartToUse(final String sName, Frame parent, final GUIState simulation) { Bag charts = new Bag(); if (simulation.guiObjects != null) for (int i = 0; i < simulation.guiObjects.numObjs; i++) if (simulation.guiObjects.objs[i] instanceof ChartGenerator && validChartGenerator((ChartGenerator) (simulation.guiObjects.objs[i]))) charts.add(simulation.guiObjects.objs[i]); if (charts.numObjs == 0) return createNewChart(simulation); // init the dialog panel JPanel p = new JPanel(); p.setLayout(new BorderLayout()); String[] chartNames = new String[charts.numObjs + 1]; chartNames[0] = "[Create a New Chart]"; for (int i = 0; i < charts.numObjs; i++) chartNames[i + 1] = ((ChartGenerator) (charts.objs[i])).getTitle(); // add widgets JPanel panel2 = new JPanel(); panel2.setLayout(new BorderLayout()); panel2.setBorder(new javax.swing.border.TitledBorder("Plot on Chart...")); JComboBox encoding = new JComboBox(chartNames); panel2.add(encoding, BorderLayout.CENTER); p.add(panel2, BorderLayout.SOUTH); // ask if (JOptionPane.showConfirmDialog( parent, p, "Create a New Chart...", JOptionPane.OK_CANCEL_OPTION) != JOptionPane.OK_OPTION) return null; if (encoding.getSelectedIndex() == 0) return createNewChart(simulation); else return (ChartGenerator) (charts.objs[encoding.getSelectedIndex() - 1]); }
public MainPanel() { super(new BorderLayout()); JPanel p = new JPanel(new GridLayout(2, 1)); final JComboBox<String> c0 = makeComboBox(true, false); final JComboBox<String> c1 = makeComboBox(false, false); final JComboBox<String> c2 = makeComboBox(true, true); final JComboBox<String> c3 = makeComboBox(false, true); p.add(makeTitlePanel("setEditable(false)", Arrays.asList(c0, c1))); p.add(makeTitlePanel("setEditable(true)", Arrays.asList(c2, c3))); p.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); add(p, BorderLayout.NORTH); add( new JButton( new AbstractAction("add") { @Override public void actionPerformed(ActionEvent e) { String str = new Date().toString(); for (JComboBox<String> c : Arrays.asList(c0, c1, c2, c3)) { MutableComboBoxModel<String> m = (MutableComboBoxModel<String>) c.getModel(); m.insertElementAt(str, m.getSize()); } } }), BorderLayout.SOUTH); setPreferredSize(new Dimension(320, 240)); }
private void jbInit() throws Exception { border1 = BorderFactory.createEmptyBorder(20, 20, 20, 20); contentPane.setBorder(border1); contentPane.setLayout(borderLayout1); controlsPane.setLayout(gridLayout1); gridLayout1.setColumns(1); gridLayout1.setHgap(10); gridLayout1.setRows(0); gridLayout1.setVgap(10); okButton.setVerifyInputWhenFocusTarget(true); okButton.setMnemonic('O'); okButton.setText("OK"); buttonsPane.setLayout(flowLayout1); flowLayout1.setAlignment(FlowLayout.CENTER); messagePane.setEditable(false); messagePane.setText(""); borderLayout1.setHgap(10); borderLayout1.setVgap(10); this.setTitle("Subscription Authorization"); this.getContentPane().add(contentPane, BorderLayout.CENTER); contentPane.add(controlsPane, BorderLayout.SOUTH); controlsPane.add(responsesComboBox, null); controlsPane.add(buttonsPane, null); buttonsPane.add(okButton, null); contentPane.add(messageScrollPane, BorderLayout.CENTER); messageScrollPane.getViewport().add(messagePane, null); }
protected JPanel makeOutput() { JPanel p = new JPanel(new BorderLayout()); myOutput = new JTextArea(10, 40); p.setBorder(BorderFactory.createTitledBorder("output")); p.add(new JScrollPane(myOutput), BorderLayout.CENTER); return p; }
/** * Creates the panel that appears when there are no pages * * @return JPanel */ protected JPanel createFirstPanel() { firstButtonPanel = new JPanel(new GridBagLayout()); firstButtonPanel.setBorder(BorderFactory.createLineBorder(Color.black)); firstButtonPanel.addMouseListener( new MouseAdapter() { public void mouseClicked(MouseEvent _evt) { if (OSPRuntime.isPopupTrigger(_evt)) return; // SwingUtilities.isRightMouseButton(_evt)) return; if (!firstButtonPanel.isEnabled()) return; Object obj = JOptionPane.showInputDialog( getComponent(), res.getString("TabbedEditor.NewName"), res.getString("TabbedEditor.Rename"), JOptionPane.QUESTION_MESSAGE, null, null, getUniqueName(defaultString)); if (obj == null) return; String txt = obj.toString().trim(); if (txt.length() > 0) addPage(defaultType, txt, null, true); else addPage(defaultType, defaultString, null, true); } }); String label = res.getOptionalString("TabbedEditor.ClickHere." + defaultHeader); if (label == null) label = res.getString("TabbedEditor.ClickHere"); firstButton = new JLabel(label); firstButton.setFont(firstButton.getFont().deriveFont(TabbedEditor.BUTTON_FONT_SIZE)); firstButtonPanel.add(firstButton); JPanel firstPanel = new JPanel(new GridLayout(0, 1)); firstPanel.add(firstButtonPanel); return firstPanel; }
public static void updateResultsTable(Object[][] data) { // remove old route table resultsPanel.removeAll(); // create new route table String[] columnNames = { "Route #", "Carrier", "Dep. Airport", "Dep. Time", "Arr. Airport", "Arr. Time", "Price" }; JScrollPane routeTable = new JScrollPane( new JTable(data, columnNames) { public boolean isCellEditable(int rowIndex, int vColIndex) { return false; }; }); // create the routes table in a scrollPane routeTable.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); routeTable.setPreferredSize(new Dimension(resultsPanelWidth, resultsPanelHeight)); resultsPanel.add(routeTable); // add the table to the JPanel resultsPanel.setBorder(BorderFactory.createTitledBorder("Search Results")); // display new route table resultsPanel.revalidate(); resultsPanel.repaint(); }
private JComponent createRecentProjects() { JPanel panel = new JPanel(new BorderLayout()); panel.add(new NewRecentProjectPanel(this), BorderLayout.CENTER); panel.setBackground(getProjectsBackground()); panel.setBorder(new CustomLineBorder(getSeparatorColor(), JBUI.insetsRight(1))); return panel; }
private void initUI() { JPanel infoPanel = new JPanel(); infoPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); infoPanel.setBackground(Color.WHITE); infoPanel.setBorder(BorderFactory.createLineBorder(Color.BLACK)); infoPanel.add( new JLabel( new ImageIcon( Thread.currentThread().getContextClassLoader().getResource("siw-logo3_2.gif")))); JLabel textLabel = new JLabel("<html>Confirmation</html>"); infoPanel.add(textLabel); JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new GridLayout(0, 1)); buttonPanel.add(reportLabel); this.setLayout(new BorderLayout()); this.add(infoPanel, BorderLayout.NORTH); this.add(buttonPanel, BorderLayout.CENTER); }
public UpgradesPanel(ORUIManager orUIManager) { super(BoxLayout.Y_AXIS); this.orUIManager = orUIManager; preferredSize = new Dimension((int) Math.round(100 * (2 + Scale.getFontScale()) / 3), 200); setSize(preferredSize); setVisible(true); upgradePanel = new JPanel(); upgradePanel.setOpaque(true); upgradePanel.setBackground(Color.DARK_GRAY); upgradePanel.setBorder(border); upgradePanel.setLayout(new GridLayout(defaultNbPanelElements, 1)); scrollPane = new JScrollPane(upgradePanel); scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); scrollPane.setSize(getPreferredSize()); doneButton.setActionCommand("Done"); doneButton.setMnemonic(KeyEvent.VK_D); doneButton.addActionListener(this); cancelButton.setActionCommand("Cancel"); cancelButton.setMnemonic(KeyEvent.VK_C); cancelButton.addActionListener(this); add(scrollPane); }
void makeFrame() { JPanel p = new JPanel(); p.setBackground(Color.blue); p.setLayout(new BorderLayout(0, 0)); p.setBorder(new EmptyBorder(0, GAP, GAP, GAP)); days.setFont(BIG); days.setForeground(COLOR); p.add(days, "North"); left.setFont(NORM); left.setForeground(COLOR); p.add(left, "South"); JFrame f = new JFrame("Sayaç"); // a window f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); f.setContentPane(p); setDate(); f.pack(); // minimal size f.setVisible(true); // show f.addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) { stop(); } }); }