List of usage examples for java.awt BorderLayout WEST
String WEST
To view the source code for java.awt BorderLayout WEST.
Click Source Link
From source file:net.sf.jabref.gui.ImportInspectionDialog.java
/** * Creates a dialog that displays the given list of fields in the table. The * dialog allows another process to add entries dynamically while the dialog * is shown.//from w ww . ja v a 2s . c om * * @param frame * @param panel */ public ImportInspectionDialog(JabRefFrame frame, BasePanel panel, String undoName, boolean newDatabase) { this.frame = frame; this.panel = panel; this.bibDatabaseContext = (panel == null) ? null : panel.getBibDatabaseContext(); this.undoName = undoName; this.newDatabase = newDatabase; setIconImage(new ImageIcon(IconTheme.getIconUrl("jabrefIcon48")).getImage()); preview = new PreviewPanel(null, bibDatabaseContext, Globals.prefs.get(JabRefPreferences.PREVIEW_0)); duplLabel.setToolTipText(Localization.lang("Possible duplicate of existing entry. Click to resolve.")); sortedList = new SortedList<>(entries); DefaultEventTableModel<BibEntry> tableModelGl = (DefaultEventTableModel<BibEntry>) GlazedListsSwing .eventTableModelWithThreadProxyList(sortedList, new EntryTableFormat()); glTable = new EntryTable(tableModelGl); GeneralRenderer renderer = new GeneralRenderer(Color.white); glTable.setDefaultRenderer(JLabel.class, renderer); glTable.setDefaultRenderer(String.class, renderer); glTable.getInputMap().put(Globals.getKeyPrefs().getKey(KeyBinding.DELETE_ENTRY), "delete"); DeleteListener deleteListener = new DeleteListener(); glTable.getActionMap().put("delete", deleteListener); selectionModel = (DefaultEventSelectionModel<BibEntry>) GlazedListsSwing .eventSelectionModelWithThreadProxyList(sortedList); glTable.setSelectionModel(selectionModel); selectionModel.getSelected().addListEventListener(new EntrySelectionListener()); comparatorChooser = TableComparatorChooser.install(glTable, sortedList, AbstractTableComparatorChooser.MULTIPLE_COLUMN_KEYBOARD); setupComparatorChooser(); glTable.addMouseListener(new TableClickListener()); setWidths(); getContentPane().setLayout(new BorderLayout()); progressBar.setIndeterminate(true); JPanel centerPan = new JPanel(); centerPan.setLayout(new BorderLayout()); contentPane.setTopComponent(new JScrollPane(glTable)); contentPane.setBottomComponent(preview); centerPan.add(contentPane, BorderLayout.CENTER); centerPan.add(progressBar, BorderLayout.SOUTH); popup.add(deleteListener); popup.addSeparator(); if (!newDatabase && (bibDatabaseContext != null)) { GroupTreeNode node = bibDatabaseContext.getMetaData().getGroups(); JMenu groupsAdd = new JMenu(Localization.lang("Add to group")); groupsAdd.setEnabled(false); // Will get enabled if there are groups that can be added to. insertNodes(groupsAdd, node); popup.add(groupsAdd); } // Add "Attach file" menu choices to right click menu: popup.add(new LinkLocalFile()); popup.add(new DownloadFile()); popup.add(new AutoSetLinks()); popup.add(new AttachUrl()); getContentPane().add(centerPan, BorderLayout.CENTER); ButtonBarBuilder bb = new ButtonBarBuilder(); bb.addGlue(); bb.addButton(ok); bb.addButton(stop); JButton cancel = new JButton(Localization.lang("Cancel")); bb.addButton(cancel); bb.addRelatedGap(); JButton help = new HelpAction(HelpFile.IMPORT_INSPECTION).getHelpButton(); bb.addButton(help); bb.addGlue(); bb.getPanel().setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); ButtonStackBuilder builder = new ButtonStackBuilder(); JButton selectAll = new JButton(Localization.lang("Select all")); builder.addButton(selectAll); JButton deselectAll = new JButton(Localization.lang("Deselect all")); builder.addButton(deselectAll); builder.addButton(deselectAllDuplicates); builder.addRelatedGap(); JButton delete = new JButton(Localization.lang("Delete")); builder.addButton(delete); builder.addRelatedGap(); builder.addFixed(autoGenerate); builder.addButton(generate); builder.getPanel().setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); centerPan.add(builder.getPanel(), BorderLayout.WEST); ok.setEnabled(false); generate.setEnabled(false); ok.addActionListener(new OkListener()); cancel.addActionListener(e -> { signalStopFetching(); dispose(); frame.output(Localization.lang("Import canceled by user")); }); generate.addActionListener(e -> { generate.setEnabled(false); generatedKeys = true; // To prevent the button from getting // enabled again. generateKeys(); // Generate the keys. }); stop.addActionListener(e -> { signalStopFetching(); entryListComplete(); }); selectAll.addActionListener(new SelectionButton(true)); deselectAll.addActionListener(new SelectionButton(false)); deselectAllDuplicates.addActionListener(e -> { for (int i = 0; i < glTable.getRowCount(); i++) { if (glTable.getValueAt(i, DUPL_COL) != null) { glTable.setValueAt(false, i, 0); } } glTable.repaint(); }); deselectAllDuplicates.setEnabled(false); delete.addActionListener(deleteListener); getContentPane().add(bb.getPanel(), BorderLayout.SOUTH); // Remember and default to last size: setSize(new Dimension(Globals.prefs.getInt(JabRefPreferences.IMPORT_INSPECTION_DIALOG_WIDTH), Globals.prefs.getInt(JabRefPreferences.IMPORT_INSPECTION_DIALOG_HEIGHT))); addWindowListener(new WindowAdapter() { @Override public void windowOpened(WindowEvent e) { contentPane.setDividerLocation(0.5f); } @Override public void windowClosed(WindowEvent e) { Globals.prefs.putInt(JabRefPreferences.IMPORT_INSPECTION_DIALOG_WIDTH, getSize().width); Globals.prefs.putInt(JabRefPreferences.IMPORT_INSPECTION_DIALOG_HEIGHT, getSize().height); } }); // Key bindings: Action closeAction = new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { dispose(); } }; ActionMap am = contentPane.getActionMap(); InputMap im = contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW); im.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE_DIALOG), "close"); am.put("close", closeAction); }
From source file:org.richie.codeGen.ui.GenAndPreviewUI.java
/** * ??/* w w w. j ava2 s . c o m*/ * * @param fileName * @param fileContent */ private void addPreviewTablePanel(String fileName, String fileContent) { final JScrollPane content = new JScrollPane(); JTextArea viewTextArea = new JTextArea(); viewTextArea.setText(fileContent); content.setViewportView(viewTextArea); JPanel tab = new JPanel(); tab.setOpaque(false); JLabel tabLabel = new JLabel(fileName); ImageIcon closeXIcon = new ImageIcon(ClassLoader.getSystemResource("resources/images/close.gif")); JButton tabCloseButton = new JButton(closeXIcon); tabCloseButton.setToolTipText("close"); tabCloseButton.setBorder(null); tabCloseButton.setContentAreaFilled(false); tabCloseButton.setPreferredSize(new Dimension(closeXIcon.getIconWidth(), closeXIcon.getIconHeight())); tabCloseButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { int closeTabNumber = mainPanel.indexOfComponent(content); mainPanel.removeTabAt(closeTabNumber); } }); tab.add(tabLabel, BorderLayout.WEST); tab.add(tabCloseButton, BorderLayout.EAST); mainPanel.addTab(null, content); mainPanel.setTabComponentAt(mainPanel.getTabCount() - 1, tab); mainPanel.setSelectedComponent(content); }
From source file:edu.ucla.stat.SOCR.applications.demo.PortfolioApplication2.java
protected void setMixPanel() { sliderPanel2.removeAll();/*from w w w.j ava 2s .c o m*/ graphPanel2.removeAll(); graphPanel2.setPreferredSize(new Dimension(CHART_SIZE_X * 2 / 3, CHART_SIZE_Y * 2 / 3)); graphPanel2.setLayout(new BoxLayout(graphPanel2, BoxLayout.Y_AXIS)); if (chartPanel != null) graphPanel2.add(chartPanel); /*if (legendPanelOn){ if (legendPanel !=null) legendPanel.setPreferredSize(new Dimension(CHART_SIZE_X*2/3,CHART_SIZE_Y*2/5)); JScrollPane legendPane = new JScrollPane(legendPanel); legendPane.setPreferredSize(new Dimension(CHART_SIZE_X*2/3,CHART_SIZE_Y*2/5)); graphPanel2.add(legendPane); }*/ graphPanel2.validate(); sliderPanel2.setPreferredSize(new Dimension(CHART_SIZE_X * 2 / 3, CHART_SIZE_Y * 2 / 3)); sliderPanel2.add(new JLabel(" ")); JScrollPane dt = new JScrollPane(sliderPanel); dt.setPreferredSize(new Dimension(CHART_SIZE_X * 3 / 2, CHART_SIZE_Y)); sliderPanel2.add(dt); /*JScrollPane st = new JScrollPane(summaryPanel); st.setPreferredSize(new Dimension(CHART_SIZE_X/3,CHART_SIZE_Y/6)); sliderPanel2.add(st); st.validate(); sliderPanel2.add(new JLabel(" ")); sliderPanel2.add(new JLabel("Mapping")); mapPanel.setPreferredSize(new Dimension(CHART_SIZE_X/3, CHART_SIZE_Y/2)); sliderPanel2.add(mapPanel);*/ sliderPanel2.validate(); mixPanel.removeAll(); mixPanel.add(graphPanel2, BorderLayout.WEST); mixPanel.add(new JScrollPane(sliderPanel2), BorderLayout.CENTER); mixPanel.validate(); }
From source file:org.sikuli.ide.SikuliIDE.java
private void initSikuliIDE(String[] args) { prefs = PreferencesUser.getInstance(); if (prefs.getUserType() < 0) { prefs.setUserType(PreferencesUser.NEWBEE); prefs.setIdeSession(""); prefs.setDefaults(prefs.getUserType()); }//from www.jav a2s. c o m ResourceLoader.get().check(Settings.SIKULI_LIB); _windowSize = prefs.getIdeSize(); _windowLocation = prefs.getIdeLocation(); Screen m = (Screen) (new Location(_windowLocation)).getScreen(); if (m == null) { String em = "Remembered window not valid.\nGoing to primary screen"; log(-1, em); Sikulix.popError(em, "IDE has problems ..."); m = Screen.getPrimaryScreen(); _windowSize.width = 0; } Rectangle s = m.getBounds(); if (_windowSize.width == 0 || _windowSize.width > s.width || _windowSize.height > s.height) { if (s.width < 1025) { _windowSize = new Dimension(1024, 700); _windowLocation = new Point(0, 0); } else { _windowSize = new Dimension(s.width - 150, s.height - 100); _windowLocation = new Point(75, 0); } } setSize(_windowSize); setLocation(_windowLocation); Debug.log(3, "IDE: Adding components to window"); initMenuBars(this); final Container c = getContentPane(); c.setLayout(new BorderLayout()); Debug.log(3, "IDE: creating tabbed editor"); initTabPane(); Debug.log(3, "IDE: creating message area"); initMsgPane(prefs.getPrefMoreMessage() == PreferencesUser.HORIZONTAL); // RaiMan not used initSidePane(); // IDE UnitTest Debug.log(3, "IDE: creating combined work window"); JPanel codeAndUnitPane = new JPanel(new BorderLayout(10, 10)); codeAndUnitPane.setBorder(BorderFactory.createEmptyBorder(0, 8, 0, 0)); codeAndUnitPane.add(tabPane, BorderLayout.CENTER); // RaiMan not used codeAndUnitPane.add(_sidePane, BorderLayout.EAST); if (prefs.getPrefMoreMessage() == PreferencesUser.VERTICAL) { _mainSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, codeAndUnitPane, msgPane); } else { _mainSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, codeAndUnitPane, msgPane); } _mainSplitPane.setResizeWeight(0.6); _mainSplitPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); Debug.log(3, "IDE: Putting all together"); JPanel editPane = new JPanel(new BorderLayout(0, 0)); JComponent cp = createCommandPane(); if (PreferencesUser.getInstance().getPrefMoreCommandBar()) { editPane.add(cp, BorderLayout.WEST); } editPane.add(_mainSplitPane, BorderLayout.CENTER); c.add(editPane, BorderLayout.CENTER); JToolBar tb = initToolbar(); c.add(tb, BorderLayout.NORTH); // the buttons c.add(initStatusbar(), BorderLayout.SOUTH); c.doLayout(); initShortcutKeys(); initHotkeys(); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); initWindowListener(); initTooltip(); autoCheckUpdate(); _inited = true; try { getCurrentCodePane().requestFocus(); } catch (Exception e) { } restoreSession(0); if (tabPane.getTabCount() == 0) { (new FileAction()).doNew(null); } tabPane.setSelectedIndex(0); Debug.log(3, "Sikuli-IDE startup: " + ((new Date()).getTime() - start)); setVisible(true); _mainSplitPane.setDividerLocation(0.6); return; // as breakpoint }
From source file:jchrest.gui.VisualSearchPane.java
private JPanel constructSelector() { JPanel panel = new JPanel(); panel.setLayout(new BorderLayout()); panel.add(new JLabel("Scene: "), BorderLayout.WEST); _sceneSelector = new JComboBox(_scenes.getSceneNames()); _sceneSelector.addActionListener(new AbstractAction() { public void actionPerformed(ActionEvent e) { Scene newScene = _scenes.get(_sceneSelector.getSelectedIndex()); //TODO: fix this when perceiver functionality working correctly. // _model.getPerceiver().setScene (newScene); _sceneDisplay.updateScene(newScene); }//www. ja va 2 s . com }); panel.add(_sceneSelector); return panel; }
From source file:tkwatch.Utilities.java
/** * Returns a standard panel for the bottom (SOUTH) of all windows. *///from w w w . jav a 2s. co m public static final JPanel getStatusPanel() { ImageIcon poweredByT4j = new ImageIcon("poweredByT4j.gif"); // TODO Messageline currently used for Twitter4J banner. Could be used // for expected status messages, currently implemented as dialog boxes. final JLabel messageLine = new JLabel(); messageLine.setIcon(poweredByT4j); final JPanel buttonPanel = new JPanel(new GridLayout(Constants.ONE_ROW, Constants.THREE_COLUMNS)); buttonPanel.add(getQuitButton()); final JPanel statusPanel = new JPanel(new BorderLayout()); statusPanel.add(messageLine, BorderLayout.WEST); statusPanel.add(buttonPanel, BorderLayout.EAST); statusPanel.updateUI(); return statusPanel; }
From source file:metdemo.Finance.Pluggable.java
protected void addBottomControls(final JPanel jp) { final JPanel control_panel = new JPanel(); jp.add(control_panel, BorderLayout.SOUTH); control_panel.setLayout(new BorderLayout()); final Box vertex_panel = Box.createVerticalBox(); vertex_panel.setBorder(BorderFactory.createTitledBorder("Vertices")); final Box edge_panel = Box.createVerticalBox(); edge_panel.setBorder(BorderFactory.createTitledBorder("Edges")); final Box both_panel = Box.createVerticalBox(); control_panel.add(vertex_panel, BorderLayout.WEST); control_panel.add(edge_panel, BorderLayout.EAST); control_panel.add(both_panel, BorderLayout.CENTER); // set up vertex controls v_color = new JCheckBox("vertex seed coloring"); v_color.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { vcf.setSeedColoring(v_color.isSelected()); }//from w w w . j a v a 2 s . com }); v_stroke = new JCheckBox("<html>vertex selection<p>stroke highlighting</html>"); v_stroke.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { vsh.setHighlight(v_stroke.isSelected()); } }); v_labels = new JCheckBox("show vertex ranks (voltages)"); v_labels.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (v_labels.isSelected()) pr.setVertexStringer(vs); else pr.setVertexStringer(vs_none); } }); v_shape = new JCheckBox("vertex degree shapes"); v_shape.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { vssa.useFunnyShapes(v_shape.isSelected()); } }); v_size = new JCheckBox("vertex voltage size"); v_size.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { vssa.setScaling(v_size.isSelected()); } }); v_aspect = new JCheckBox("vertex degree ratio stretch"); v_aspect.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { vssa.setStretching(v_aspect.isSelected()); } }); v_small = new JCheckBox("filter vertices of degree < " + VertexDisplayPredicate.MIN_DEGREE); v_small.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { show_vertex.filterSmall(v_small.isSelected()); } }); vertex_panel.add(v_color); vertex_panel.add(v_stroke); vertex_panel.add(v_labels); vertex_panel.add(v_shape); vertex_panel.add(v_size); vertex_panel.add(v_aspect); vertex_panel.add(v_small); // set up edge controls JPanel gradient_panel = new JPanel(new GridLayout(1, 0)); gradient_panel.setBorder(BorderFactory.createTitledBorder("Edge paint")); no_gradient = new JRadioButton("Solid color"); no_gradient.setSelected(true); no_gradient.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { gradient_level = GRADIENT_NONE; } }); // gradient_absolute = new JRadioButton("Absolute gradient"); // gradient_absolute.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e) { gradient_level = GRADIENT_ABSOLUTE;}}); gradient_relative = new JRadioButton("Gradient"); gradient_relative.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { gradient_level = GRADIENT_RELATIVE; } }); ButtonGroup bg_grad = new ButtonGroup(); bg_grad.add(no_gradient); bg_grad.add(gradient_relative); //bg_grad.add(gradient_absolute); gradient_panel.add(no_gradient); //gradientGrid.add(gradient_absolute); gradient_panel.add(gradient_relative); JPanel shape_panel = new JPanel(new GridLayout(3, 2)); shape_panel.setBorder(BorderFactory.createTitledBorder("Edge shape")); e_line = new JRadioButton("line"); e_line.setSelected(true); e_line.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { pr.setEdgeShapeFunction(new EdgeShape.Line()); } }); // e_bent = new JRadioButton("bent line"); // e_bent.setSelected(true); e_wedge = new JRadioButton("wedge"); e_wedge.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { pr.setEdgeShapeFunction(new EdgeShape.Wedge(10)); } }); e_quad = new JRadioButton("quad curve"); e_quad.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { pr.setEdgeShapeFunction(new EdgeShape.QuadCurve()); } }); e_cubic = new JRadioButton("cubic curve"); e_cubic.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { pr.setEdgeShapeFunction(new EdgeShape.CubicCurve()); } }); ButtonGroup bg_shape = new ButtonGroup(); bg_shape.add(e_line); // bg.add(e_bent); bg_shape.add(e_wedge); bg_shape.add(e_quad); bg_shape.add(e_cubic); shape_panel.add(e_line); // shape_panel.add(e_bent); shape_panel.add(e_wedge); shape_panel.add(e_quad); shape_panel.add(e_cubic); fill_edges = new JCheckBox("fill edge shapes"); fill_edges.setSelected(false); fill_edges.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { edgePaint.useFill(fill_edges.isSelected()); } }); shape_panel.add(fill_edges); shape_panel.setOpaque(true); e_color = new JCheckBox("edge weight highlighting"); e_color.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { ewcs.setWeighted(e_color.isSelected()); } }); e_labels = new JCheckBox("show edge weights"); e_labels.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (e_labels.isSelected()) pr.setEdgeStringer(es); else pr.setEdgeStringer(es_none); } }); e_uarrow_pred = new JCheckBox("undirected"); e_uarrow_pred.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { show_arrow.showUndirected(e_uarrow_pred.isSelected()); } }); e_darrow_pred = new JCheckBox("directed"); e_darrow_pred.setSelected(true); e_darrow_pred.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { show_arrow.showDirected(e_darrow_pred.isSelected()); } }); JPanel arrow_panel = new JPanel(new GridLayout(1, 0)); arrow_panel.setBorder(BorderFactory.createTitledBorder("Show arrows")); arrow_panel.add(e_uarrow_pred); arrow_panel.add(e_darrow_pred); e_show_d = new JCheckBox("directed"); e_show_d.setSelected(true); e_show_d.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { show_edge.showDirected(e_show_d.isSelected()); } }); e_show_u = new JCheckBox("undirected"); e_show_u.setSelected(true); e_show_u.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { show_edge.showUndirected(e_show_u.isSelected()); } }); JPanel show_edge_panel = new JPanel(new GridLayout(1, 0)); show_edge_panel.setBorder(BorderFactory.createTitledBorder("Show edges")); show_edge_panel.add(e_show_u); show_edge_panel.add(e_show_d); shape_panel.setAlignmentX(Component.LEFT_ALIGNMENT); edge_panel.add(shape_panel); gradient_panel.setAlignmentX(Component.LEFT_ALIGNMENT); edge_panel.add(gradient_panel); show_edge_panel.setAlignmentX(Component.LEFT_ALIGNMENT); edge_panel.add(show_edge_panel); arrow_panel.setAlignmentX(Component.LEFT_ALIGNMENT); edge_panel.add(arrow_panel); e_color.setAlignmentX(Component.LEFT_ALIGNMENT); edge_panel.add(e_color); e_labels.setAlignmentX(Component.LEFT_ALIGNMENT); edge_panel.add(e_labels); // set up zoom controls zoom_at_mouse = new JCheckBox("<html><center>zoom at mouse<p>(wheel only)</center></html>"); zoom_at_mouse.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { gm.setZoomAtMouse(zoom_at_mouse.isSelected()); } }); JButton plus = new JButton("+"); plus.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { // call listener in GraphMouse instead of manipulating vv scale directly // this is so the crossover from zoom to scale works with the buttons // as well as with the mouse wheel Dimension d = vv.getSize(); gm.mouseWheelMoved(new MouseWheelEvent(vv, MouseEvent.MOUSE_WHEEL, System.currentTimeMillis(), 0, d.width / 2, d.height / 2, 1, false, MouseWheelEvent.WHEEL_UNIT_SCROLL, 1, 1)); } }); JButton minus = new JButton("-"); minus.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { // call listener in GraphMouse instead of manipulating vv scale directly // this is so the crossover from zoom to scale works with the buttons // as well as with the mouse wheel Dimension d = vv.getSize(); gm.mouseWheelMoved(new MouseWheelEvent(vv, MouseEvent.MOUSE_WHEEL, System.currentTimeMillis(), 0, d.width / 2, d.height / 2, 1, false, MouseWheelEvent.WHEEL_UNIT_SCROLL, 1, -1)); } }); Box zoomPanel = Box.createVerticalBox(); zoomPanel.setBorder(BorderFactory.createTitledBorder("Zoom")); plus.setAlignmentX(Component.CENTER_ALIGNMENT); zoomPanel.add(plus); minus.setAlignmentX(Component.CENTER_ALIGNMENT); zoomPanel.add(minus); zoom_at_mouse.setAlignmentX(Component.CENTER_ALIGNMENT); zoomPanel.add(zoom_at_mouse); // add font and zoom controls to center panel font = new JCheckBox("bold text"); font.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { ff.setBold(font.isSelected()); } }); font.setAlignmentX(Component.CENTER_ALIGNMENT); both_panel.add(zoomPanel); both_panel.add(font); JComboBox modeBox = gm.getModeComboBox(); modeBox.setAlignmentX(Component.CENTER_ALIGNMENT); JPanel modePanel = new JPanel(new BorderLayout()) { public Dimension getMaximumSize() { return getPreferredSize(); } }; modePanel.setBorder(BorderFactory.createTitledBorder("Mouse Mode")); modePanel.add(modeBox); both_panel.add(modePanel); }
From source file:org.rdv.viz.image.ImageViz.java
private void initFocusControls() { focusControls = new JPanel(); focusControls.setLayout(new BorderLayout()); JButton nearFocusButton = new JButton(DataViewer.getIcon("icons/ptz/robotic_control-near.gif")); nearFocusButton.setBorder(null);/*from w w w . j a v a2 s .c o m*/ nearFocusButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { focusNear(); } }); focusControls.add(nearFocusButton, BorderLayout.WEST); JButton focusControlButton = new StrechIconButton( DataViewer.getIcon("icons/ptz/robotic_control-focusbar-medium.gif")); focusControlButton.setBorder(null); focusControlButton.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { JButton button = (JButton) e.getComponent(); int focus = Math.round(100f * e.getPoint().x / button.getWidth()); focus(focus); } }); focusControls.add(focusControlButton, BorderLayout.CENTER); JPanel focusControlsRight = new JPanel(); focusControlsRight.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0)); JButton farFocusButton = new JButton(DataViewer.getIcon("icons/ptz/robotic_control-far.gif")); farFocusButton.setBorder(null); farFocusButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { focusFar(); } }); focusControlsRight.add(farFocusButton); JButton autoFocusButton = new JButton(DataViewer.getIcon("icons/ptz/robotic_control-auto.gif")); autoFocusButton.setBorder(null); autoFocusButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { focusAuto(); } }); focusControlsRight.add(autoFocusButton); focusControls.add(focusControlsRight, BorderLayout.EAST); }
From source file:org.apache.jmeter.protocol.http.control.gui.WebServiceSamplerGui.java
private JPanel getProxyHostPanel() { proxyHost = new JTextField(12); JLabel label = new JLabel(JMeterUtils.getResString("web_server_domain")); // $NON-NLS-1$ label.setLabelFor(proxyHost);// www . jav a 2 s .com JPanel panel = new JPanel(new BorderLayout(5, 0)); panel.add(label, BorderLayout.WEST); panel.add(proxyHost, BorderLayout.CENTER); return panel; }
From source file:org.isatools.isacreatorconfigurator.configui.FieldInterface.java
private void instantiateFields(String initFieldName) { // OVERALL CONTAINER JPanel container = new JPanel(); container.setLayout(new BoxLayout(container, BoxLayout.PAGE_AXIS)); container.setBackground(UIHelper.BG_COLOR); JLabel fieldDefinitionLab = new JLabel(fieldDefinitionHeader, JLabel.CENTER); container.add(fieldDefinitionLab);/*from w w w . ja va2 s . co m*/ container.add(Box.createVerticalStrut(5)); // FIELD LABEL & INPUT BOX CONTAINER JPanel fieldCont = new JPanel(new GridLayout(1, 2)); fieldCont.setBackground(UIHelper.BG_COLOR); fieldName = new RoundedJTextField(15); fieldName.setText(initFieldName); fieldName.setEditable(false); UIHelper.renderComponent(fieldName, UIHelper.VER_11_PLAIN, UIHelper.DARK_GREEN_COLOR, false); JLabel fieldNameLab = UIHelper.createLabel("Field Name: ", UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR); fieldCont.add(fieldNameLab); fieldCont.add(fieldName); container.add(fieldCont); JPanel descCont = new JPanel(new GridLayout(1, 2)); descCont.setBackground(UIHelper.BG_COLOR); description = new RoundedJTextArea(); description.setLineWrap(true); description.setWrapStyleWord(true); UIHelper.renderComponent(description, UIHelper.VER_11_PLAIN, UIHelper.DARK_GREEN_COLOR, false); JScrollPane descScroll = new JScrollPane(description, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); descScroll.setBackground(UIHelper.BG_COLOR); descScroll.setPreferredSize(new Dimension(150, 65)); descScroll.getViewport().setBackground(UIHelper.BG_COLOR); IAppWidgetFactory.makeIAppScrollPane(descScroll); JLabel descLab = UIHelper.createLabel("Description: ", UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR); descLab.setVerticalAlignment(JLabel.TOP); descCont.add(descLab); descCont.add(descScroll); container.add(descCont); // add datatype information JPanel datatypeCont = new JPanel(new GridLayout(1, 2)); datatypeCont.setBackground(UIHelper.BG_COLOR); DataTypes[] allowedDataTypes = initFieldName.equals(UNIT_STR) ? new DataTypes[] { DataTypes.ONTOLOGY_TERM } : DataTypes.values(); datatype = new JComboBox(allowedDataTypes); datatype.addActionListener(this); UIHelper.renderComponent(datatype, UIHelper.VER_11_PLAIN, UIHelper.DARK_GREEN_COLOR, UIHelper.BG_COLOR); JLabel dataTypeLab = UIHelper.createLabel("Datatype:", UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR); datatypeCont.add(dataTypeLab); datatypeCont.add(datatype); container.add(datatypeCont); defaultValContStd = new JPanel(new GridLayout(1, 2)); defaultValContStd.setBackground(UIHelper.BG_COLOR); defaultValCont = Box.createHorizontalBox(); defaultValCont.setPreferredSize(new Dimension(150, 25)); defaultValStd = new RoundedFormattedTextField(null, UIHelper.TRANSPARENT_LIGHT_GREEN_COLOR, UIHelper.DARK_GREEN_COLOR); defaultValCont.setPreferredSize(new Dimension(120, 25)); defaultValStd.setFormatterFactory(new DefaultFormatterFactory( new RegExFormatter(".*", defaultValStd, false, UIHelper.DARK_GREEN_COLOR, UIHelper.RED_COLOR, UIHelper.TRANSPARENT_LIGHT_GREEN_COLOR, UIHelper.TRANSPARENT_LIGHT_GREEN_COLOR))); defaultValStd.setForeground(UIHelper.DARK_GREEN_COLOR); defaultValStd.setFont(UIHelper.VER_11_PLAIN); defaultValCont.add(defaultValStd); defaultValLabStd = UIHelper.createLabel(DEFAULT_VAL_STR, UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR); defaultValContStd.add(defaultValLabStd); defaultValContStd.add(defaultValCont); container.add(defaultValContStd); defaultValContBool = new JPanel(new GridLayout(1, 2)); defaultValContBool.setBackground(UIHelper.BG_COLOR); defaultValContBool.setVisible(false); listDataSourceCont = new JPanel(new GridLayout(2, 1)); listDataSourceCont.setBackground(UIHelper.BG_COLOR); listDataSourceCont.setVisible(false); JLabel listValLab = UIHelper.createLabel("Please enter comma separated list of values:", UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR); listDataSourceCont.add(listValLab); listValues = new RoundedJTextArea("SampleVal1, SampleVal2, SampleVal3", 3, 5); listValues.setLineWrap(true); listValues.setWrapStyleWord(true); UIHelper.renderComponent(listValues, UIHelper.VER_11_PLAIN, UIHelper.DARK_GREEN_COLOR, false); JScrollPane listScroll = new JScrollPane(listValues, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); listScroll.setBackground(UIHelper.BG_COLOR); listScroll.getViewport().setBackground(UIHelper.BG_COLOR); listDataSourceCont.add(listScroll); container.add(listDataSourceCont); IAppWidgetFactory.makeIAppScrollPane(listScroll); sourceEntryPanel = new JPanel(new BorderLayout()); sourceEntryPanel.setSize(new Dimension(125, 190)); sourceEntryPanel.setOpaque(false); sourceEntryPanel.setVisible(false); preferredOntologySource = new JPanel(); preferredOntologySource.setLayout(new BoxLayout(preferredOntologySource, BoxLayout.PAGE_AXIS)); preferredOntologySource.setVisible(false); recommendOntologySource = new JCheckBox("Use recommended ontology source?", false); UIHelper.renderComponent(recommendOntologySource, UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR, false); recommendOntologySource.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (recommendOntologySource.isSelected()) { sourceEntryPanel.setVisible(true); } else { sourceEntryPanel.setVisible(false); } } }); JPanel useOntologySourceCont = new JPanel(new GridLayout(1, 1)); useOntologySourceCont.add(recommendOntologySource); preferredOntologySource.add(useOntologySourceCont); JPanel infoCont = new JPanel(new GridLayout(1, 1)); JLabel infoLab = UIHelper.createLabel( "<html>click on the <strong>configure ontologies</strong> button to open the ontology configurator to edit the list of ontologies and search areas within an ontology</html>", UIHelper.VER_11_PLAIN, UIHelper.DARK_GREEN_COLOR); infoLab.setPreferredSize(new Dimension(100, 40)); infoCont.add(infoLab); sourceEntryPanel.add(infoCont, BorderLayout.NORTH); JLabel preferredOntologiesLab = new JLabel(preferredOntologiesSidePanelIcon); preferredOntologiesLab.setVerticalAlignment(SwingConstants.TOP); sourceEntryPanel.add(preferredOntologiesLab, BorderLayout.WEST); ontologiesToUseModel = new DefaultTableModel(new String[0][2], ontologyColumnHeaders) { @Override public boolean isCellEditable(int i, int i1) { return false; } }; ontologiesToUse = new JTable(ontologiesToUseModel); ontologiesToUse.getTableHeader().setBackground(UIHelper.BG_COLOR); try { ontologiesToUse.setDefaultRenderer(Class.forName("java.lang.Object"), new CustomSpreadsheetCellRenderer()); } catch (ClassNotFoundException e) { // empty } renderTableHeader(); JScrollPane ontologiesToUseScroller = new JScrollPane(ontologiesToUse, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); ontologiesToUseScroller.setBorder(new EmptyBorder(0, 0, 0, 0)); ontologiesToUseScroller.setPreferredSize(new Dimension(100, 80)); ontologiesToUseScroller.setBackground(UIHelper.BG_COLOR); ontologiesToUseScroller.getViewport().setBackground(UIHelper.BG_COLOR); IAppWidgetFactory.makeIAppScrollPane(ontologiesToUseScroller); sourceEntryPanel.add(ontologiesToUseScroller); JPanel buttonCont = new JPanel(new BorderLayout()); final JLabel openConfigButton = new JLabel(ontologyConfigIcon); openConfigButton.setVerticalAlignment(SwingConstants.TOP); openConfigButton.setHorizontalAlignment(SwingConstants.RIGHT); MouseAdapter showOntologyConfigurator = new MouseAdapter() { public void mouseEntered(MouseEvent mouseEvent) { openConfigButton.setIcon(ontologyConfigIconOver); } public void mouseExited(MouseEvent mouseEvent) { openConfigButton.setIcon(ontologyConfigIcon); } public void mousePressed(MouseEvent mouseEvent) { SwingUtilities.invokeLater(new Runnable() { public void run() { if (openConfigButton.isEnabled()) { openConfigButton.setIcon(ontologyConfigIcon); ontologyConfig = new OntologyConfigUI(ontologiesToQuery, selectedOntologies); ontologyConfig.addPropertyChangeListener("ontologySelected", new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent propertyChangeEvent) { selectedOntologies = (ListOrderedMap<String, RecommendedOntology>) propertyChangeEvent .getNewValue(); updateTable(); } }); showPopupInCenter(ontologyConfig); } } }); } }; openConfigButton.addMouseListener(showOntologyConfigurator); buttonCont.add(openConfigButton, BorderLayout.EAST); sourceEntryPanel.add(buttonCont, BorderLayout.SOUTH); preferredOntologySource.add(sourceEntryPanel); container.add(preferredOntologySource); String[] contents = new String[] { "true", "false" }; defaultValBool = new JComboBox(contents); UIHelper.renderComponent(defaultValBool, UIHelper.VER_12_PLAIN, UIHelper.DARK_GREEN_COLOR, UIHelper.BG_COLOR); JLabel defaultValLabBool = UIHelper.createLabel(DEFAULT_VAL_STR, UIHelper.VER_12_BOLD, UIHelper.DARK_GREEN_COLOR); defaultValContBool.add(defaultValLabBool); defaultValContBool.add(defaultValBool); container.add(defaultValContBool); // RegExp data entry isInputFormatted = new JCheckBox("Is the input formatted?", false); isInputFormatted.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); isInputFormatted.setHorizontalAlignment(SwingConstants.LEFT); UIHelper.renderComponent(isInputFormatted, UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR, false); isInputFormatted.addActionListener(this); container.add(UIHelper.wrapComponentInPanel(isInputFormatted)); inputFormatCont = new JPanel(); inputFormatCont.setLayout(new BoxLayout(inputFormatCont, BoxLayout.LINE_AXIS)); inputFormatCont.setVisible(false); inputFormatCont.setBackground(UIHelper.BG_COLOR); inputFormat = new RoundedJTextField(10); inputFormat.setText(".*"); inputFormat.setSize(new Dimension(150, 19)); inputFormat.setPreferredSize(new Dimension(160, 25)); inputFormat.setToolTipText("Field expects a regular expression describing the input format."); UIHelper.renderComponent(inputFormat, UIHelper.VER_11_PLAIN, UIHelper.DARK_GREEN_COLOR, false); JLabel inputFormatLab = UIHelper.createLabel("Input format:", UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR); inputFormatLab.setVerticalAlignment(SwingConstants.TOP); inputFormatCont.add(inputFormatLab); inputFormatCont.add(inputFormat); JLabel checkRegExp = new JLabel(checkRegExIcon, JLabel.RIGHT); checkRegExp.setOpaque(false); checkRegExp.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { String regexToCheck = inputFormat.getText(); final CheckRegExGUI regexChecker = new CheckRegExGUI(regexToCheck); SwingUtilities.invokeLater(new Runnable() { public void run() { regexChecker.createGUI(); } }); regexChecker.addPropertyChangeListener("close", new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { main.getApplicationContainer().hideSheet(); } }); SwingUtilities.invokeLater(new Runnable() { public void run() { main.getApplicationContainer().showJDialogAsSheet(regexChecker); } }); } } ); inputFormatCont.add(checkRegExp); container.add(inputFormatCont); usesTemplateForWizard = new JCheckBox("Requires template for wizard?", false); usesTemplateForWizard.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); usesTemplateForWizard.setHorizontalAlignment(SwingConstants.LEFT); UIHelper.renderComponent(usesTemplateForWizard, UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR, false); usesTemplateForWizard.addActionListener(this); container.add(UIHelper.wrapComponentInPanel(usesTemplateForWizard)); wizardTemplatePanel = new JPanel(new GridLayout(1, 2)); wizardTemplatePanel.setVisible(false); wizardTemplatePanel.setBackground(UIHelper.BG_COLOR); wizardTemplate = new RoundedJTextArea(); wizardTemplate.setToolTipText("A template for the wizard to auto-create the data..."); wizardTemplate.setLineWrap(true); wizardTemplate.setWrapStyleWord(true); UIHelper.renderComponent(wizardTemplate, UIHelper.VER_11_PLAIN, UIHelper.DARK_GREEN_COLOR, false); JScrollPane wizScroll = new JScrollPane(wizardTemplate, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); wizScroll.getViewport().setBackground(UIHelper.BG_COLOR); wizScroll.setPreferredSize(new Dimension(70, 60)); IAppWidgetFactory.makeIAppScrollPane(wizScroll); JLabel wizardTemplateLab = UIHelper.createLabel("Template definition:", UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR); wizardTemplateLab.setVerticalAlignment(JLabel.TOP); wizardTemplatePanel.add(wizardTemplateLab); wizardTemplatePanel.add(wizScroll); container.add(wizardTemplatePanel); JPanel checkCont = new JPanel(new GridLayout(3, 2)); checkCont.setBackground(UIHelper.BG_COLOR); checkCont.setBorder(new TitledBorder(new RoundedBorder(UIHelper.DARK_GREEN_COLOR, 4), "Behavioural Attributes", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR)); required = new JCheckBox("Required ", true); UIHelper.renderComponent(required, UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR, false); checkCont.add(required); acceptsMultipleValues = new JCheckBox("Allow multiple instances", false); UIHelper.renderComponent(acceptsMultipleValues, UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR, false); checkCont.add(acceptsMultipleValues); acceptsFileLocations = new JCheckBox("Accepts file locations", false); acceptsFileLocations.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { acceptsMultipleValues.setSelected(false); acceptsMultipleValues.setEnabled(!acceptsFileLocations.isSelected()); } }); UIHelper.renderComponent(acceptsFileLocations, UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR, false); checkCont.add(acceptsFileLocations); hidden = new JCheckBox("hidden?", false); UIHelper.renderComponent(hidden, UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR, false); checkCont.add(hidden); forceOntologySelection = new JCheckBox("Force ontology selection", false); UIHelper.renderComponent(forceOntologySelection, UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR, false); checkCont.add(forceOntologySelection); container.add(checkCont); JScrollPane contScroll = new JScrollPane(container, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); contScroll.setBorder(null); contScroll.setAutoscrolls(true); IAppWidgetFactory.makeIAppScrollPane(contScroll); add(contScroll, BorderLayout.NORTH); }