List of usage examples for java.awt BorderLayout EAST
String EAST
To view the source code for java.awt BorderLayout EAST.
Click Source Link
From source file:com.epiq.bitshark.ui.FrequencyDomainPanel.java
/** * This was originally generated code so it still * needs some cleanup.//from ww w . ja v a 2s . c o m */ private void initComponents() { topPanel = new javax.swing.JPanel(); headerPanel = new org.jdesktop.swingx.JXPanel(); topLeftHeaderPanel = new javax.swing.JPanel(); graphLabel = new javax.swing.JLabel(); chartLabelSpacerPanel = new javax.swing.JPanel(); topRightHeaderPanel = new javax.swing.JPanel(); topRightControlPanel = new javax.swing.JPanel(); alphaLabel = new javax.swing.JLabel(); alphaSlider = new javax.swing.JSlider(); windowLabel = new javax.swing.JLabel(); windowComboBox = new javax.swing.JComboBox(); rightSpacerPanel = new javax.swing.JPanel(); leftSpacerPanel = new javax.swing.JPanel(); mainPanel = new javax.swing.JPanel(); setLayout(new java.awt.BorderLayout()); topPanel.setPreferredSize(new java.awt.Dimension(0, 30)); topPanel.setLayout(new java.awt.BorderLayout()); headerPanel.setBackground(new java.awt.Color(0, 0, 0)); headerPanel.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(121, 123, 125))); headerPanel.setPreferredSize(new java.awt.Dimension(0, 30)); headerPanel.setLayout(new java.awt.BorderLayout()); topLeftHeaderPanel.setOpaque(false); topLeftHeaderPanel.setLayout(new java.awt.BorderLayout()); graphLabel.setFont(new java.awt.Font("Tahoma", 1, 12)); graphLabel.setText("Frequency Domain"); graphLabel.setForeground(new java.awt.Color(255, 255, 255)); topLeftHeaderPanel.add(graphLabel, java.awt.BorderLayout.CENTER); chartLabelSpacerPanel.setOpaque(false); chartLabelSpacerPanel.setPreferredSize(new java.awt.Dimension(10, 0)); topLeftHeaderPanel.add(chartLabelSpacerPanel, java.awt.BorderLayout.WEST); headerPanel.add(topLeftHeaderPanel, java.awt.BorderLayout.WEST); topRightHeaderPanel.setOpaque(false); topRightHeaderPanel.setLayout(new java.awt.BorderLayout()); topRightControlPanel.setOpaque(false); topRightControlPanel.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.CENTER, 10, 2)); alphaLabel.setText("Alpha:"); alphaLabel.setForeground(new java.awt.Color(255, 255, 255)); topRightControlPanel.add(alphaLabel); alphaSlider.setMaximum(10000); alphaSlider.setOpaque(false); alphaSlider.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { alphaSliderStateChanged(evt); } }); topRightControlPanel.add(alphaSlider); windowLabel.setText("Window:"); windowLabel.setForeground(new java.awt.Color(255, 255, 255)); topRightControlPanel.add(windowLabel); windowComboBox.setModel( new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); windowComboBox.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { windowComboBoxActionPerformed(evt); } }); topRightControlPanel.add(windowComboBox); topRightHeaderPanel.add(topRightControlPanel, java.awt.BorderLayout.EAST); headerPanel.add(topRightHeaderPanel, java.awt.BorderLayout.EAST); topPanel.add(headerPanel, java.awt.BorderLayout.CENTER); rightSpacerPanel.setPreferredSize(new java.awt.Dimension(7, 0)); topPanel.add(rightSpacerPanel, java.awt.BorderLayout.EAST); leftSpacerPanel.setOpaque(false); leftSpacerPanel.setPreferredSize(new java.awt.Dimension(44, 0)); topPanel.add(leftSpacerPanel, java.awt.BorderLayout.WEST); add(topPanel, java.awt.BorderLayout.NORTH); mainPanel.setLayout(new java.awt.BorderLayout()); add(mainPanel, java.awt.BorderLayout.CENTER); }
From source file:org.kepler.gui.KeplerGraphFrame.java
/** * Override BasicGraphFrame._initBasicGraphFrame() *//*from w w w .jav a 2 s .c o m*/ @Override protected void _initBasicGraphFrame() { /** * @todo - FIXME - Need to move this further up the hierarchy, so other * types of frames use it too. Don't put it in a launcher class * like KeplerApplication, because it then gets overridden later, * elsewhere in PTII */ StaticGUIResources.setLookAndFeel(); _initBasicGraphFrameInitialization(); _dropTarget = BasicGraphFrameExtension.getDropTarget(_jgraph); // add a CanvasDropTargetListener so that other classes can get CanvasDropTargetListener listener = CanvasDropTargetListener.getInstance(); _dropTarget.registerAdditionalListener(listener); ActionListener deletionListener = new DeletionListener(); _rightComponent.registerKeyboardAction(deletionListener, "Delete", KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); _rightComponent.registerKeyboardAction(deletionListener, "BackSpace", KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); _initBasicGraphFrameRightComponent(); _jgraph.setRequestFocusEnabled(true); // Background color is parameterizable by preferences. Configuration configuration = getConfiguration(); if (configuration != null) { try { // Set the PtolemyPreference to the desired background. // See // http://bugzilla.ecoinformatics.org/show_bug.cgi?id=2321#c14 PtolemyPreferences preferences = PtolemyPreferences .getPtolemyPreferencesWithinConfiguration(configuration); if (_isDebugging) { _log.debug("bg: " + BACKGROUND_COLOR); } if (preferences != null) { float[] components = new float[4]; // Make sure we get only 4 elements in case the color space // is bigger than 4 components = BACKGROUND_COLOR.getComponents(components); preferences.backgroundColor.setExpression("{" + components[0] + "," + components[1] + "," + components[2] + "," + components[3] + "}"); _rightComponent.setBackground(preferences.backgroundColor.asColor()); if (_isDebugging) { _log.debug("desired background: " + BACKGROUND_COLOR + " actual background: " + preferences.backgroundColor.asColor()); } } } catch (IllegalActionException e1) { // Ignore the exception and use the default color. } } _initBasicGraphFrameRightComponentMouseListeners(); try { // The SizeAttribute property is used to specify the size // of the JGraph component. Unfortunately, with Swing's // mysterious and undocumented handling of component sizes, // there appears to be no way to control the size of the // JGraph from the size of the Frame, which is specified // by the WindowPropertiesAttribute. SizeAttribute size = (SizeAttribute) getModel().getAttribute("_vergilSize", SizeAttribute.class); if (size != null) { size.setSize(_jgraph); } else { // Set the default size. // Note that the location is of the frame, while the size // is of the scrollpane. _jgraph.setPreferredSize(new Dimension(600, 400)); } _initBasicGraphFrameSetZoomAndPan(); } catch (Exception ex) { // Ignore problems here. Errors simply result in a default // size and location. } // Create the panner. _graphPanner = new JCanvasPanner(_jgraph); _horizontalScrollBar = new JScrollBar(Adjustable.HORIZONTAL); _verticalScrollBar = new JScrollBar(Adjustable.VERTICAL); // see if we want scrollbars on the canvas or not // the answer defaults to 'no' CanvasNavigationModifierFactory CNMfactory = (CanvasNavigationModifierFactory) getConfiguration() .getAttribute("canvasNavigationModifier"); if (CNMfactory != null) { // get the scrollbar flag from the factory if // it exists in the config ScrollBarModifier modifier = CNMfactory.createScrollBarModifier(); _scrollBarFlag = modifier.getScrollBarModifier(); } _canvasPanel = new JPanel(); _canvasPanel.setBorder(null); _canvasPanel.setLayout(new BorderLayout()); if (_scrollBarFlag) { _canvasPanel.add(_horizontalScrollBar, BorderLayout.SOUTH); _canvasPanel.add(_verticalScrollBar, BorderLayout.EAST); _horizontalScrollBar.setModel(_jgraph.getGraphPane().getCanvas().getHorizontalRangeModel()); _verticalScrollBar.setModel(_jgraph.getGraphPane().getCanvas().getVerticalRangeModel()); _horizontalScrollBarListener = new ScrollBarListener(_horizontalScrollBar); _verticalScrollBarListener = new ScrollBarListener(_verticalScrollBar); _horizontalScrollBar.addAdjustmentListener(_horizontalScrollBarListener); _verticalScrollBar.addAdjustmentListener(_verticalScrollBarListener); } // NOTE: add _rightComponent instead of _jgraph since _rightComponent // may be sub-divided into tabbed panes. // see http://bugzilla.ecoinformatics.org/show_bug.cgi?id=3708 _canvasPanel.add(_rightComponent, BorderLayout.CENTER); TabManager tabman = TabManager.getInstance(); tabman.initializeTabs(this); ViewManager viewman = ViewManager.getInstance(); viewman.initializeViews(this); try { viewman.addCanvasToLocation(_canvasPanel, this); } catch (Exception e) { throw new RuntimeException("Could not add canvas panel: " + e.getMessage()); } // _jgraph.setMinimumSize(new Dimension(0, 0)); getContentPane().add(viewman.getViewArea(this), BorderLayout.CENTER); // The toolbar panel is the container that contains the main toolbar and // any additional toolbars JPanel toolbarPanel = new JPanel(); toolbarPanel.setLayout(new BoxLayout(toolbarPanel, BoxLayout.Y_AXIS)); // They // stack _toolbar = new JToolBar(); // The main Kepler toolbar toolbarPanel.add(_toolbar); getContentPane().add(toolbarPanel, BorderLayout.NORTH); // Place the // toolbar panel _initBasicGraphFrameToolBarZoomButtons(); _initBasicGraphFrameActions(); // Add a weak reference to this to keep track of all // the graph frames that have been created. _openGraphFrames.add(this); System.gc(); }
From source file:org.esa.snap.rcp.spectrum.SpectrumTopComponent.java
private void initUI() { final JFreeChart chart = ChartFactory.createXYLineChart(Bundle.CTL_SpectrumTopComponent_Name(), "Wavelength (nm)", "", null, PlotOrientation.VERTICAL, true, true, false); chart.getXYPlot().getRangeAxis().addChangeListener(axisChangeEvent -> { if (!isCodeInducedAxisChange) { rangeAxisAdjustmentIsFrozen = !((ValueAxis) axisChangeEvent.getAxis()).isAutoRange(); }/*from w w w . ja v a 2 s. c o m*/ }); chart.getXYPlot().getDomainAxis().addChangeListener(axisChangeEvent -> { if (!isCodeInducedAxisChange) { domainAxisAdjustmentIsFrozen = !((ValueAxis) axisChangeEvent.getAxis()).isAutoRange(); } }); chart.getXYPlot().getRangeAxis().setAutoRange(false); rangeAxisAdjustmentIsFrozen = false; chart.getXYPlot().getDomainAxis().setAutoRange(false); domainAxisAdjustmentIsFrozen = false; chartPanel = new ChartPanel(chart); chartHandler = new ChartHandler(chart); final XYPlotMarker plotMarker = new XYPlotMarker(chartPanel, new XYPlotMarker.Listener() { @Override public void pointSelected(XYDataset xyDataset, int seriesIndex, Point2D dataPoint) { //do nothing } @Override public void pointDeselected() { //do nothing } }); filterButton = ToolButtonFactory.createButton(UIUtils.loadImageIcon("icons/Filter24.gif"), false); filterButton.setName("filterButton"); filterButton.setEnabled(false); filterButton.addActionListener(e -> { selectSpectralBands(); recreateChart(); }); showSpectrumForCursorButton = ToolButtonFactory .createButton(UIUtils.loadImageIcon("icons/CursorSpectrum24.gif"), true); showSpectrumForCursorButton.addActionListener(e -> recreateChart()); showSpectrumForCursorButton.setName("showSpectrumForCursorButton"); showSpectrumForCursorButton.setSelected(true); showSpectrumForCursorButton.setToolTipText("Show spectrum at cursor position."); showSpectraForSelectedPinsButton = ToolButtonFactory .createButton(UIUtils.loadImageIcon("icons/SelectedPinSpectra24.gif"), true); showSpectraForSelectedPinsButton.addActionListener(e -> { if (isShowingSpectraForAllPins()) { showSpectraForAllPinsButton.setSelected(false); } else if (!isShowingSpectraForSelectedPins()) { plotMarker.setInvisible(); } recreateChart(); }); showSpectraForSelectedPinsButton.setName("showSpectraForSelectedPinsButton"); showSpectraForSelectedPinsButton.setToolTipText("Show spectra for selected pins."); showSpectraForAllPinsButton = ToolButtonFactory .createButton(UIUtils.loadImageIcon("icons/PinSpectra24.gif"), true); showSpectraForAllPinsButton.addActionListener(e -> { if (isShowingSpectraForSelectedPins()) { showSpectraForSelectedPinsButton.setSelected(false); } else if (!isShowingSpectraForAllPins()) { plotMarker.setInvisible(); } recreateChart(); }); showSpectraForAllPinsButton.setName("showSpectraForAllPinsButton"); showSpectraForAllPinsButton.setToolTipText("Show spectra for all pins."); showGridButton = ToolButtonFactory.createButton(UIUtils.loadImageIcon("icons/SpectrumGrid24.gif"), true); showGridButton.addActionListener(e -> chartHandler.setGridVisible(showGridButton.isSelected())); showGridButton.setName("showGridButton"); showGridButton.setToolTipText("Show diagram grid."); AbstractButton exportSpectraButton = ToolButtonFactory .createButton(UIUtils.loadImageIcon("icons/Export24.gif"), false); exportSpectraButton.addActionListener(new SpectraExportAction(this)); exportSpectraButton.setToolTipText("Export spectra to text file."); exportSpectraButton.setName("exportSpectraButton"); AbstractButton helpButton = ToolButtonFactory.createButton(new HelpAction(this), false); helpButton.setName("helpButton"); helpButton.setToolTipText("Help."); final JPanel buttonPane = GridBagUtils.createPanel(); final GridBagConstraints gbc = new GridBagConstraints(); gbc.anchor = GridBagConstraints.CENTER; gbc.fill = GridBagConstraints.NONE; gbc.insets.top = 2; gbc.gridy = 0; buttonPane.add(filterButton, gbc); gbc.gridy++; buttonPane.add(showSpectrumForCursorButton, gbc); gbc.gridy++; buttonPane.add(showSpectraForSelectedPinsButton, gbc); gbc.gridy++; buttonPane.add(showSpectraForAllPinsButton, gbc); gbc.gridy++; buttonPane.add(showGridButton, gbc); gbc.gridy++; buttonPane.add(exportSpectraButton, gbc); gbc.gridy++; gbc.insets.bottom = 0; gbc.fill = GridBagConstraints.VERTICAL; gbc.weighty = 1.0; gbc.gridwidth = 2; buttonPane.add(new JLabel(" "), gbc); // filler gbc.fill = GridBagConstraints.NONE; gbc.weighty = 0.0; gbc.gridy = 10; gbc.anchor = GridBagConstraints.EAST; buttonPane.add(helpButton, gbc); chartPanel.setPreferredSize(new Dimension(300, 200)); chartPanel.setBackground(Color.white); chartPanel.setBorder(BorderFactory.createCompoundBorder( BorderFactory.createBevelBorder(BevelBorder.LOWERED), BorderFactory.createEmptyBorder(2, 2, 2, 2))); chartPanel.addChartMouseListener(plotMarker); JPanel mainPane = new JPanel(new BorderLayout(4, 4)); mainPane.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); mainPane.add(BorderLayout.CENTER, chartPanel); mainPane.add(BorderLayout.EAST, buttonPane); mainPane.setPreferredSize(new Dimension(320, 200)); SnapApp.getDefault().getProductManager().addListener(new ProductManager.Listener() { @Override public void productAdded(ProductManager.Event event) { // ignored } @Override public void productRemoved(ProductManager.Event event) { final Product product = event.getProduct(); if (getCurrentProduct() == product) { chartPanel.getChart().getXYPlot().setDataset(null); setCurrentView(null); setCurrentProduct(null); } if (currentView != null) { final RasterDataNode currentRaster = currentView.getRaster(); if (rasterToSpectraMap.containsKey(currentRaster)) { rasterToSpectraMap.remove(currentRaster); } if (rasterToSpectralBandsMap.containsKey(currentRaster)) { rasterToSpectralBandsMap.remove(currentRaster); } } PlacemarkGroup pinGroup = product.getPinGroup(); for (int i = 0; i < pinGroup.getNodeCount(); i++) { chartHandler.removePinInformation(pinGroup.get(i)); } } }); final ProductSceneView view = getSelectedProductSceneView(); if (view != null) { productSceneViewSelected(view); } setDisplayName(Bundle.CTL_SpectrumTopComponent_Name()); setLayout(new BorderLayout()); add(mainPane, BorderLayout.CENTER); updateUIState(); }
From source file:mondrian.gui.Workbench.java
/** * This method is called from within the constructor to * initialize the form.//from w ww. jav a2 s .c o m */ private void initComponents() { desktopPane = new javax.swing.JDesktopPane(); jToolBar1 = new javax.swing.JToolBar(); jToolBar2 = new javax.swing.JToolBar(); toolbarNewPopupMenu = new JPopupMenu(); toolbarNewButton = new javax.swing.JButton(); toolbarOpenButton = new javax.swing.JButton(); toolbarSaveButton = new javax.swing.JButton(); toolbarSaveAsButton = new javax.swing.JButton(); jPanel1 = new javax.swing.JPanel(); jPanel2 = new javax.swing.JPanel(); toolbarPreferencesButton = new javax.swing.JButton(); requireSchemaCheckboxMenuItem = new javax.swing.JCheckBoxMenuItem(); menuBar = new javax.swing.JMenuBar(); fileMenu = new javax.swing.JMenu(); newMenu = new javax.swing.JMenu(); newSchemaMenuItem = new javax.swing.JMenuItem(); newQueryMenuItem = new javax.swing.JMenuItem(); newJDBCExplorerMenuItem = new javax.swing.JMenuItem(); newSchemaMenuItem2 = new javax.swing.JMenuItem(); newQueryMenuItem2 = new javax.swing.JMenuItem(); newJDBCExplorerMenuItem2 = new javax.swing.JMenuItem(); openMenuItem = new javax.swing.JMenuItem(); preferencesMenuItem = new javax.swing.JMenuItem(); lastUsed1MenuItem = new javax.swing.JMenuItem(); lastUsed2MenuItem = new javax.swing.JMenuItem(); lastUsed3MenuItem = new javax.swing.JMenuItem(); lastUsed4MenuItem = new javax.swing.JMenuItem(); saveMenuItem = new javax.swing.JMenuItem(); saveAsMenuItem = new javax.swing.JMenuItem(); jSeparator1 = new javax.swing.JSeparator(); jSeparator2 = new javax.swing.JSeparator(); jSeparator3 = new javax.swing.JSeparator(); exitMenuItem = new javax.swing.JMenuItem(); windowMenu = new javax.swing.JMenu(); helpMenu = new javax.swing.JMenu(); editMenu = new javax.swing.JMenu(); cutMenuItem = new javax.swing.JMenuItem(new DefaultEditorKit.CutAction()); copyMenuItem = new javax.swing.JMenuItem(new DefaultEditorKit.CopyAction()); pasteMenuItem = new javax.swing.JMenuItem(new DefaultEditorKit.PasteAction()); deleteMenuItem = new javax.swing.JMenuItem( new AbstractAction(getResourceConverter().getString("workbench.menu.delete", "Delete")) { private static final long serialVersionUID = 1L; public void actionPerformed(ActionEvent e) { JInternalFrame jf = desktopPane.getSelectedFrame(); if (jf != null && jf.getContentPane().getComponent(0) instanceof SchemaExplorer) { SchemaExplorer se = (SchemaExplorer) jf.getContentPane().getComponent(0); TreePath tpath = se.tree.getSelectionPath(); se.delete(tpath); } } }); aboutMenuItem = new javax.swing.JMenuItem(); toolsMenu = new javax.swing.JMenu(); viewMenu = new javax.swing.JMenu(); viewXmlMenuItem = new javax.swing.JCheckBoxMenuItem(); setTitle(getResourceConverter().getString("workbench.panel.title", "Schema Workbench")); setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent evt) { storeWorkbenchProperties(); storeDatabaseMeta(); closeAllSchemaFrames(true); } }); getContentPane().add(desktopPane, java.awt.BorderLayout.CENTER); newSchemaMenuItem2.setText(getResourceConverter().getString("workbench.menu.newSchema", "Schema")); newSchemaMenuItem2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { newSchemaMenuItemActionPerformed(evt); } }); newQueryMenuItem2.setText(getResourceConverter().getString("workbench.menu.newQuery", "MDX Query")); newQueryMenuItem2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { newQueryMenuItemActionPerformed(evt); } }); newJDBCExplorerMenuItem2 .setText(getResourceConverter().getString("workbench.menu.newJDBC", "JDBC Explorer")); newJDBCExplorerMenuItem2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { newJDBCExplorerMenuItemActionPerformed(evt); } }); toolbarNewPopupMenu.add(newSchemaMenuItem2); toolbarNewPopupMenu.add(newQueryMenuItem2); toolbarNewPopupMenu.add(newJDBCExplorerMenuItem2); jPanel2.setLayout(new java.awt.BorderLayout()); jPanel2.setBorder(javax.swing.BorderFactory.createEtchedBorder()); jPanel2.setMaximumSize(new java.awt.Dimension(50, 28)); toolbarNewButton.setIcon( new javax.swing.ImageIcon(getClass().getResource(getResourceConverter().getGUIReference("new")))); toolbarNewButton.setToolTipText(getResourceConverter().getString("workbench.toolbar.new", "New")); toolbarNewButton.setBorderPainted(false); toolbarNewButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { toolbarNewPopupMenu.show(jPanel2, 0, jPanel2.getSize().height); } }); jToolBar2.setFloatable(false); jToolBar2.add(toolbarNewButton); jPanel2.add(jToolBar2, java.awt.BorderLayout.CENTER); toolbarNewArrowButton = new BasicArrowButton(SwingConstants.SOUTH); toolbarNewArrowButton.setToolTipText(getResourceConverter().getString("workbench.toolbar.newArrow", "New")); toolbarNewArrowButton.setBorderPainted(false); toolbarNewArrowButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { toolbarNewPopupMenu.show(jPanel2, 0, jPanel2.getSize().height); } }); jPanel2.add(toolbarNewArrowButton, java.awt.BorderLayout.EAST); jToolBar1.add(jPanel2, 0); toolbarOpenButton.setIcon( new javax.swing.ImageIcon(getClass().getResource(getResourceConverter().getGUIReference("open")))); toolbarOpenButton.setToolTipText(getResourceConverter().getString("workbench.toolbar.open", "Open")); toolbarOpenButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { openMenuItemActionPerformed(evt); } }); jToolBar1.add(toolbarOpenButton); toolbarSaveButton.setIcon( new javax.swing.ImageIcon(getClass().getResource(getResourceConverter().getGUIReference("save")))); toolbarSaveButton.setToolTipText(getResourceConverter().getString("workbench.toolbar.save", "Save")); toolbarSaveButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { saveMenuItemActionPerformed(evt); } }); jToolBar1.add(toolbarSaveButton); toolbarSaveAsButton.setIcon(new javax.swing.ImageIcon( getClass().getResource(getResourceConverter().getGUIReference("saveAs")))); toolbarSaveAsButton.setToolTipText(getResourceConverter().getString("workbench.toolbar.saveAs", "Save As")); toolbarSaveAsButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { saveAsMenuItemActionPerformed(evt); } }); jToolBar1.add(toolbarSaveAsButton); jPanel1.setMaximumSize(new java.awt.Dimension(8, 8)); jToolBar1.add(jPanel1); toolbarPreferencesButton.setIcon(new javax.swing.ImageIcon( getClass().getResource(getResourceConverter().getGUIReference("preferences")))); toolbarPreferencesButton .setToolTipText(getResourceConverter().getString("workbench.toolbar.connection", "Connection")); toolbarPreferencesButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { connectionButtonActionPerformed(evt); } }); jToolBar1.add(toolbarPreferencesButton); getContentPane().add(jToolBar1, java.awt.BorderLayout.NORTH); fileMenu.setText(getResourceConverter().getString("workbench.menu.file", "File")); fileMenu.setMnemonic(KeyEvent.VK_F); newMenu.setText(getResourceConverter().getString("workbench.menu.new", "New")); newSchemaMenuItem.setText(getResourceConverter().getString("workbench.menu.newSchema", "Schema")); newSchemaMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { newSchemaMenuItemActionPerformed(evt); } }); newMenu.add(newSchemaMenuItem); newQueryMenuItem.setText(getResourceConverter().getString("workbench.menu.newQuery", "MDX Query")); newQueryMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { newQueryMenuItemActionPerformed(evt); } }); newMenu.add(newQueryMenuItem); newJDBCExplorerMenuItem .setText(getResourceConverter().getString("workbench.menu.newJDBC", "JDBC Explorer")); newJDBCExplorerMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { newJDBCExplorerMenuItemActionPerformed(evt); } }); newMenu.add(newJDBCExplorerMenuItem); fileMenu.add(newMenu); openMenuItem.setText(getResourceConverter().getString("workbench.menu.open", "Open")); openMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { openMenuItemActionPerformed(evt); } }); fileMenu.add(openMenuItem); saveMenuItem.setText(getResourceConverter().getString("workbench.menu.save", "Save")); saveMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { saveMenuItemActionPerformed(evt); } }); fileMenu.add(saveMenuItem); saveAsMenuItem.setText(getResourceConverter().getString("workbench.menu.saveAsDot", "Save As ...")); saveAsMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { saveAsMenuItemActionPerformed(evt); } }); fileMenu.add(saveAsMenuItem); // add last used fileMenu.add(jSeparator2); lastUsed1MenuItem.setText(getWorkbenchProperty("lastUsed1")); lastUsed1MenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { lastUsed1MenuItemActionPerformed(evt); } }); fileMenu.add(lastUsed1MenuItem); lastUsed2MenuItem.setText(getWorkbenchProperty("lastUsed2")); lastUsed2MenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { lastUsed2MenuItemActionPerformed(evt); } }); fileMenu.add(lastUsed2MenuItem); lastUsed3MenuItem.setText(getWorkbenchProperty("lastUsed3")); lastUsed3MenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { lastUsed3MenuItemActionPerformed(evt); } }); fileMenu.add(lastUsed3MenuItem); lastUsed4MenuItem.setText(getWorkbenchProperty("lastUsed4")); lastUsed4MenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { lastUsed4MenuItemActionPerformed(evt); } }); fileMenu.add(lastUsed4MenuItem); updateLastUsedMenu(); fileMenu.add(jSeparator1); exitMenuItem.setText(getResourceConverter().getString("workbench.menu.exit", "Exit")); exitMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { exitMenuItemActionPerformed(evt); } }); fileMenu.add(exitMenuItem); menuBar.add(fileMenu); editMenu.setText(getResourceConverter().getString("workbench.menu.edit", "Edit")); editMenu.setMnemonic(KeyEvent.VK_E); cutMenuItem.setText(getResourceConverter().getString("workbench.menu.cut", "Cut")); editMenu.add(cutMenuItem); copyMenuItem.setText(getResourceConverter().getString("workbench.menu.copy", "Copy")); editMenu.add(copyMenuItem); pasteMenuItem.setText(getResourceConverter().getString("workbench.menu.paste", "Paste")); editMenu.add(pasteMenuItem); editMenu.add(deleteMenuItem); menuBar.add(editMenu); viewMenu.setText(getResourceConverter().getString("workbench.menu.view", "View")); viewMenu.setMnemonic(KeyEvent.VK_V); viewXmlMenuItem.setText(getResourceConverter().getString("workbench.menu.viewXML", "View XML")); viewXmlMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { viewXMLMenuItemActionPerformed(evt); } }); viewMenu.add(viewXmlMenuItem); menuBar.add(viewMenu); toolsMenu.setText(getResourceConverter().getString("workbench.menu.options", "Options")); toolsMenu.setMnemonic(KeyEvent.VK_O); preferencesMenuItem.setText(getResourceConverter().getString("workbench.menu.connection", "Connection")); preferencesMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { connectionButtonActionPerformed(evt); } }); toolsMenu.add(preferencesMenuItem); requireSchemaCheckboxMenuItem .setText(getResourceConverter().getString("workbench.menu.requireSchema", "Require Schema")); requireSchemaCheckboxMenuItem.setSelected(requireSchema); requireSchemaCheckboxMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { requireSchemaActionPerformed(e); } }); toolsMenu.add(requireSchemaCheckboxMenuItem); menuBar.add(toolsMenu); windowMenu.setText(getResourceConverter().getString("workbench.menu.windows", "Windows")); windowMenu.setMnemonic(KeyEvent.VK_W); cascadeMenuItem = new javax.swing.JMenuItem(); cascadeMenuItem .setText(getResourceConverter().getString("workbench.menu.cascadeWindows", "Cascade Windows")); cascadeMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { cascadeMenuItemActionPerformed(evt); } }); tileMenuItem = new javax.swing.JMenuItem(); tileMenuItem.setText(getResourceConverter().getString("workbench.menu.tileWindows", "Tile Windows")); tileMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { tileMenuItemActionPerformed(evt); } }); closeAllMenuItem = new javax.swing.JMenuItem(); closeAllMenuItem.setText(getResourceConverter().getString("workbench.menu.closeAll", "Close All")); closeAllMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { closeAllMenuItemActionPerformed(evt); } }); minimizeMenuItem = new javax.swing.JMenuItem(); minimizeMenuItem.setText(getResourceConverter().getString("workbench.menu.minimizeAll", "Minimize All")); minimizeMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { minimizeMenuItemActionPerformed(evt); } }); maximizeMenuItem = new javax.swing.JMenuItem(); maximizeMenuItem.setText(getResourceConverter().getString("workbench.menu.maximizeAll", "Maximize All")); maximizeMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { maximizeMenuItemActionPerformed(evt); } }); menuBar.add(windowMenu); aboutMenuItem.setText(getResourceConverter().getString("workbench.menu.about", "About")); aboutMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { aboutMenuItemActionPerformed(evt); } }); helpMenu.add(aboutMenuItem); helpMenu.setText(getResourceConverter().getString("workbench.menu.help", "Help")); helpMenu.setMnemonic(KeyEvent.VK_H); menuBar.add(helpMenu); setJMenuBar(menuBar); pack(); }
From source file:LayeredPaneDemo4.java
protected void createTitleBar() { m_titlePanel = new JPanel() { public Dimension getPreferredSize() { return new Dimension(InnerFrame.this.getWidth(), m_titleBarHeight); }/* w w w . j a v a 2 s . c o m*/ }; m_titlePanel.setLayout(new BorderLayout()); m_titlePanel.setOpaque(true); m_titlePanel.setBackground(m_titleBarBackground); m_titleLabel = new JLabel(); m_titleLabel.setForeground(m_titleBarForeground); m_close = new InnerFrameButton(CLOSE_BUTTON_ICON); m_close.setPressedIcon(PRESS_CLOSE_BUTTON_ICON); m_close.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { InnerFrame.this.close(); } }); m_maximize = new InnerFrameButton(MAXIMIZE_BUTTON_ICON); m_maximize.setPressedIcon(PRESS_MAXIMIZE_BUTTON_ICON); m_maximize.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { InnerFrame.this.setMaximized(!InnerFrame.this.isMaximized()); } }); m_iconize = new InnerFrameButton(ICONIZE_BUTTON_ICON); m_iconize.setPressedIcon(PRESS_ICONIZE_BUTTON_ICON); m_iconize.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { InnerFrame.this.setIconified(!InnerFrame.this.isIconified()); } }); m_buttonWrapperPanel = new JPanel(); m_buttonWrapperPanel.setOpaque(false); m_buttonPanel = new JPanel(new GridLayout(1, 3)); m_buttonPanel.setOpaque(false); m_buttonPanel.add(m_iconize); m_buttonPanel.add(m_maximize); m_buttonPanel.add(m_close); m_buttonPanel.setAlignmentX(0.5f); m_buttonPanel.setAlignmentY(0.5f); m_buttonWrapperPanel.add(m_buttonPanel); m_iconLabel = new JLabel(); m_iconLabel.setBorder( new EmptyBorder(FRAME_ICON_PADDING, FRAME_ICON_PADDING, FRAME_ICON_PADDING, FRAME_ICON_PADDING)); if (m_frameIcon != null) m_iconLabel.setIcon(m_frameIcon); m_titlePanel.add(m_titleLabel, BorderLayout.CENTER); m_titlePanel.add(m_buttonWrapperPanel, BorderLayout.EAST); m_titlePanel.add(m_iconLabel, BorderLayout.WEST); InnerFrameTitleBarMouseAdapter iftbma = new InnerFrameTitleBarMouseAdapter(this); m_titlePanel.addMouseListener(iftbma); m_titlePanel.addMouseMotionListener(iftbma); }
From source file:org.ohdsi.whiteRabbit.WhiteRabbitMain.java
private JPanel createScanPanel() { JPanel panel = new JPanel(); panel.setLayout(new BorderLayout()); JPanel tablePanel = new JPanel(); tablePanel.setLayout(new BorderLayout()); tablePanel.setBorder(new TitledBorder("Tables to scan")); tableList = new JList<String>(); tableList.setToolTipText("Specify the tables (or CSV files) to be scanned here"); tablePanel.add(new JScrollPane(tableList), BorderLayout.CENTER); JPanel tableButtonPanel = new JPanel(); tableButtonPanel.setLayout(new GridLayout(3, 1)); addAllButton = new JButton("Add all in DB"); addAllButton.setToolTipText("Add all tables in the database"); addAllButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { addAllTables();//from www . j a v a 2 s . co m } }); addAllButton.setEnabled(false); tableButtonPanel.add(addAllButton); JButton addButton = new JButton("Add"); addButton.setToolTipText("Add tables to list"); addButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { pickTables(); } }); tableButtonPanel.add(addButton); JButton removeButton = new JButton("Remove"); removeButton.setToolTipText("Remove tables from list"); removeButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { removeTables(); } }); tableButtonPanel.add(removeButton); tablePanel.add(tableButtonPanel, BorderLayout.EAST); panel.add(tablePanel, BorderLayout.CENTER); JPanel southPanel = new JPanel(); southPanel.setLayout(new BoxLayout(southPanel, BoxLayout.Y_AXIS)); JPanel scanOptionsPanel = new JPanel(); scanOptionsPanel.setLayout(new BoxLayout(scanOptionsPanel, BoxLayout.X_AXIS)); scanValueScan = new JCheckBox("Scan field values", true); scanValueScan.setToolTipText("Include a frequency count of field values in the scan report"); scanValueScan.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent arg0) { scanMinCellCount.setEnabled(((JCheckBox) arg0.getSource()).isSelected()); scanRowCount.setEnabled(((JCheckBox) arg0.getSource()).isSelected()); scanValuesCount.setEnabled(((JCheckBox) arg0.getSource()).isSelected()); } }); scanOptionsPanel.add(scanValueScan); scanOptionsPanel.add(Box.createHorizontalGlue()); scanOptionsPanel.add(new JLabel("Min cell count ")); scanMinCellCount = new JSpinner(); scanMinCellCount.setValue(5); scanMinCellCount.setToolTipText("Minimum frequency for a field value to be included in the report"); scanOptionsPanel.add(scanMinCellCount); scanOptionsPanel.add(Box.createHorizontalGlue()); scanOptionsPanel.add(new JLabel("Max distinct values ")); scanValuesCount = new JComboBox<String>(new String[] { "100", "1,000", "10,000" }); scanValuesCount.setSelectedIndex(1); scanValuesCount.setToolTipText("Maximum number of distinct values per field to be reported"); scanOptionsPanel.add(scanValuesCount); scanOptionsPanel.add(Box.createHorizontalGlue()); scanOptionsPanel.add(new JLabel("Rows per table ")); scanRowCount = new JComboBox<String>(new String[] { "100,000", "500,000", "1 million", "all" }); scanRowCount.setSelectedIndex(0); scanRowCount.setToolTipText("Maximum number of rows per table to be scanned for field values"); scanOptionsPanel.add(scanRowCount); southPanel.add(scanOptionsPanel); southPanel.add(Box.createVerticalStrut(3)); JPanel scanButtonPanel = new JPanel(); scanButtonPanel.setLayout(new BoxLayout(scanButtonPanel, BoxLayout.X_AXIS)); scanButtonPanel.add(Box.createHorizontalGlue()); JButton scanButton = new JButton("Scan tables"); scanButton.setBackground(new Color(151, 220, 141)); scanButton.setToolTipText("Scan the selected tables"); scanButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { scanRun(); } }); componentsToDisableWhenRunning.add(scanButton); scanButtonPanel.add(scanButton); southPanel.add(scanButtonPanel); panel.add(southPanel, BorderLayout.SOUTH); return panel; }
From source file:org.neuroph.netbeans.main.easyneurons.NeuralGraphRenderer.java
/** * @param jp//from ww w. ja v a 2 s .c o m * panel to which controls will be added */ protected void addControls(final JPanel jp) { final JPanel control_panel = new JPanel(); jp.add(control_panel, BorderLayout.EAST); control_panel.setLayout(new GridBagLayout()); java.awt.GridBagConstraints gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.insets = new java.awt.Insets(5, 5, 0, 5); gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; // control_panel.setBackground(new Color(00, 255, 00)); final Box vertex_panel = Box.createVerticalBox(); vertex_panel.setBorder(BorderFactory.createTitledBorder("Neurons")); final Box edge_panel = Box.createVerticalBox(); edge_panel.setBorder(BorderFactory.createTitledBorder("Connections")); final Box edges_and_vertex_panel = Box.createVerticalBox(); // Box zoom_and_mode_panel = Box.createVerticalBox(); // zoom_and_mode_panel.setBorder(BorderFactory.createTitledBorder("Other controls")); // final Box layout_panel = Box.createVerticalBox(); // layout_panel.setBorder(BorderFactory.createTitledBorder("Layout")); // JPanel zoom_and_mode_panel = new JPanel(); // zoom_and_mode_panel.setLayout(new GridBagLayout() ); // //GridLayout(3,1) // zoom_and_mode_panel.setBackground(new Color(0,255,0)); edges_and_vertex_panel.add(vertex_panel); edges_and_vertex_panel.add(edge_panel); // edges_and_vertex_panel.add(layout_panel); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; control_panel.add(edges_and_vertex_panel, gridBagConstraints); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; // control_panel.add(layout_panel, gridBagConstraints); // originalni layout // control_panel.add(vertex_panel, BorderLayout.WEST); // control_panel.add(edge_panel, BorderLayout.EAST); // control_panel.add(edges_and_vertex_panel, BorderLayout.CENTER); // set up vertex controls v_color = new JCheckBox("vertex seed coloring"); v_color.addActionListener(this); // v_stroke = new JCheckBox("<html>stroke highlight selected</html>"); // v_stroke.addActionListener(this); v_shape = new JCheckBox("vertex degree shapes"); v_shape.addActionListener(this); v_size = new JCheckBox("activation size"); v_size.addActionListener(this); v_size.setSelected(false); v_aspect = new JCheckBox("vertex degree ratio stretch"); v_aspect.addActionListener(this); v_small = new JCheckBox("filter vertices of degree < " + VertexDisplayPredicate.MIN_DEGREE); v_small.addActionListener(this); // vertex_panel.add(v_color); 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); // vertex_panel.add(v_stroke); // 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.addActionListener(this); // no_gradient.setSelected(true); // // gradient_absolute = new JRadioButton("Absolute gradient"); // // gradient_absolute.addActionListener(this); // gradient_relative = new JRadioButton("Gradient"); // gradient_relative.addActionListener(this); // 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("Connection shape")); // e_line = new JRadioButton("line"); // e_line.addActionListener(this); // e_line.setSelected(true); // // e_bent = new JRadioButton("bent line"); // // e_bent.addActionListener(this); // e_wedge = new JRadioButton("wedge"); // e_wedge.addActionListener(this); // e_quad = new JRadioButton("quad curve"); // e_quad.addActionListener(this); // e_cubic = new JRadioButton("cubic curve"); // e_cubic.addActionListener(this); // 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(this); // // shape_panel.add(fill_edges); // shape_panel.setOpaque(true); e_color = new JCheckBox("weight highlighting"); e_color.addActionListener(this); e_uarrow_pred = new JCheckBox("undirected"); e_uarrow_pred.addActionListener(this); e_darrow_pred = new JCheckBox("directed"); e_darrow_pred.addActionListener(this); e_darrow_pred.setSelected(true); // 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.addActionListener(this); e_show_d.setSelected(true); e_show_u = new JCheckBox("undirected"); e_show_u.addActionListener(this); e_show_u.setSelected(true); 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); // Class<?>[] combos = getLayoutOptions(); // final JComboBox layoutCombo = new JComboBox(combos); // // use a renderer to shorten the layout name presentation // layoutCombo.setRenderer(new DefaultListCellRenderer() { // public Component getListCellRendererComponent(JList list, // Object value, int index, boolean isSelected, // boolean cellHasFocus) { // String valueString = value.toString(); // valueString = valueString.substring(valueString // .lastIndexOf('.') + 1); // return super.getListCellRendererComponent(list, valueString, // index, isSelected, cellHasFocus); // } // }); // layoutCombo.addActionListener(new LayoutChooser(layoutCombo, vv)); //// UNDO: layoutCombo.setSelectedItem(FRLayout.class); // layout_panel.add(layoutCombo); // set up zoom controls zoom_at_mouse = new JCheckBox("<html><center>zoom at mouse<p>(wheel only)</center></html>"); zoom_at_mouse.addActionListener(this); final ScalingControl scaler = new CrossoverScalingControl(); JButton plus = new JButton("+"); plus.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { scaler.scale(vv, 1.1f, vv.getCenter()); } }); JButton minus = new JButton("-"); minus.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { scaler.scale(vv, 1 / 1.1f, vv.getCenter()); } }); JPanel zoomPanel = new JPanel(); zoomPanel.setAlignmentX(Component.RIGHT_ALIGNMENT); zoomPanel.setBorder(BorderFactory.createTitledBorder("Zoom")); zoomPanel.add(plus); zoomPanel.add(minus); gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.insets = new java.awt.Insets(5, 5, 0, 5); gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; JComboBox modeBox = graphMouse.getModeComboBox(); modeBox.setAlignmentX(Component.RIGHT_ALIGNMENT); JPanel modePanel = new JPanel(new BorderLayout()) { @Override public Dimension getMaximumSize() { return getPreferredSize(); } }; modePanel.setBorder(BorderFactory.createTitledBorder("Mouse Mode")); modePanel.add(modeBox); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; control_panel.add(modePanel, gridBagConstraints); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 3; control_panel.add(zoomPanel, gridBagConstraints); // add font control to center panel font = new JCheckBox("bold text"); font.addActionListener(this); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 4; control_panel.add(font, gridBagConstraints); }
From source file:com.rapidminer.gui.plotter.charts.BarChartPlotter.java
@Override public void updatePlotter() { final int categoryCount = prepareData(); SwingUtilities.invokeLater(new Runnable() { @Override/* w w w .j a v a2 s . c om*/ public void run() { scrollablePlotterPanel.remove(viewScrollBar); } }); CategoryDataset usedCategoryDataSet = categoryDataSet; if (categoryCount > MAX_CATEGORY_VIEW_COUNT && showScrollbar) { if (orientationIndex == ORIENTATION_TYPE_VERTICAL) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { viewScrollBar.setOrientation(Adjustable.HORIZONTAL); scrollablePlotterPanel.add(viewScrollBar, BorderLayout.SOUTH); } }); } else { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { viewScrollBar.setOrientation(Adjustable.VERTICAL); scrollablePlotterPanel.add(viewScrollBar, BorderLayout.EAST); } }); } this.slidingCategoryDataSet = new SlidingCategoryDataset(categoryDataSet, 0, MAX_CATEGORY_VIEW_COUNT); viewScrollBar.setMaximum(categoryCount); viewScrollBar.setValue(0); usedCategoryDataSet = this.slidingCategoryDataSet; } else { this.slidingCategoryDataSet = null; } if (categoryCount <= MAX_CATEGORIES) { JFreeChart chart = ChartFactory.createBarChart(null, // chart title null, // domain axis label null, // range axis label usedCategoryDataSet, // data orientationIndex == ORIENTATION_TYPE_VERTICAL ? PlotOrientation.VERTICAL : PlotOrientation.HORIZONTAL, // orientation false, // include legend if group by column is set true, // tooltips false // URLs ); // set the background color for the chart... chart.setBackgroundPaint(Color.WHITE); chart.getPlot().setBackgroundPaint(Color.WHITE); CategoryPlot plot = chart.getCategoryPlot(); plot.setDomainGridlinePaint(Color.LIGHT_GRAY); plot.setRangeGridlinePaint(Color.LIGHT_GRAY); CategoryAxis domainAxis = plot.getDomainAxis(); domainAxis.setLabelFont(LABEL_FONT_BOLD); domainAxis.setTickLabelFont(LABEL_FONT); String domainName = groupByColumn >= 0 ? dataTable.getColumnName(groupByColumn) : null; domainAxis.setLabel(domainName); // rotate labels if (isLabelRotating()) { plot.getDomainAxis().setTickLabelsVisible(true); plot.getDomainAxis().setCategoryLabelPositions( CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 2.0d)); } // set the range axis to display integers only... NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setLabelFont(LABEL_FONT_BOLD); rangeAxis.setTickLabelFont(LABEL_FONT); String rangeName = valueColumn >= 0 ? dataTable.getColumnName(valueColumn) : null; rangeAxis.setLabel(rangeName); // bar renderer double[] colorValues = null; if (groupByColumn >= 0 && this.dataTable.isNominal(groupByColumn)) { colorValues = new double[this.dataTable.getNumberOfValues(groupByColumn)]; } else { colorValues = new double[categoryDataSet.getColumnCount()]; } for (int i = 0; i < colorValues.length; i++) { colorValues[i] = i; } BarRenderer renderer = new ColorizedBarRenderer(colorValues); renderer.setBarPainter(new RapidBarPainter()); renderer.setDrawBarOutline(true); int size = categoryDataSet.getRowCount(); if (size > 1) { for (int i = 0; i < size; i++) { renderer.setSeriesPaint(i, getColorProvider(true).getPointColor(i / (double) (size - 1))); } } plot.setRenderer(renderer); // legend settings LegendTitle legend = chart.getLegend(); if (legend != null) { legend.setPosition(RectangleEdge.TOP); legend.setFrame(BlockBorder.NONE); legend.setHorizontalAlignment(HorizontalAlignment.LEFT); legend.setItemFont(LABEL_FONT); } if (panel != null) { panel.setChart(chart); } else { panel = new AbstractChartPanel(chart, getWidth(), getHeight() - MARGIN); scrollablePlotterPanel.add(panel, BorderLayout.CENTER); final ChartPanelShiftController controller = new ChartPanelShiftController(panel); panel.addMouseListener(controller); panel.addMouseMotionListener(controller); } // ATTENTION: WITHOUT THIS WE GET SEVERE MEMORY LEAKS!!! panel.getChartRenderingInfo().setEntityCollection(null); } else { // LogService.getGlobal().logNote("Too many columns (" + categoryCount + // "), this chart is only able to plot up to " + MAX_CATEGORIES + // " different categories."); LogService.getRoot().log(Level.INFO, "com.rapidminer.gui.plotter.charts.BarChartPlotter.too_many_columns", new Object[] { categoryCount, MAX_CATEGORIES }); } }
From source file:com.zigabyte.stock.stratplot.StrategyPlotter.java
private void initLayout() { Container content = this.getContentPane(); JComponent controls = Box.createVerticalBox(); {//from w ww.j a va 2 s . c o m JPanel filePanel = new JPanel(new BorderLayout()); { filePanel.setBorder(BorderFactory.createTitledBorder("Stock Market Trading Data")); JPanel dataButtons = new JPanel(new GridLayout(2, 1)); { dataButtons.add(this.loadFileButton); dataButtons.add(this.viewDataButton); } filePanel.add(dataButtons, BorderLayout.EAST); JPanel fileControls = new JPanel(new FlowLayout()); { fileControls.add(new JLabel("Stock data File:")); fileControls.add(this.fileField); fileControls.add(this.fileBrowseButton); fileControls.add(new JLabel(" Stock data format:")); fileControls.add(this.fileFormatCombo); } filePanel.add(fileControls, BorderLayout.CENTER); } controls.add(filePanel); JComponent simPanel = new JPanel(new BorderLayout()); { simPanel.setBorder(BorderFactory.createTitledBorder("Simulation Run")); simPanel.add(this.runButton, BorderLayout.EAST); JComponent simControlsPanel = Box.createVerticalBox(); { JPanel accountControls = new JPanel(new FlowLayout()); { accountControls.add(new JLabel("Initial Cash:")); accountControls.add(this.initialCashField); accountControls.add(new JLabel(" Per Trade Fee:")); accountControls.add(this.perTradeFeeField); accountControls.add(new JLabel(" Per Share Trade Commission:")); accountControls.add(this.perShareTradeCommissionField); accountControls.add(new JLabel(" Compare:")); accountControls.add(this.compareIndexSymbolField); } simControlsPanel.add(accountControls); JPanel runControls = new JPanel(new FlowLayout()); { runControls.add(this.strategyField); runControls.add(new JLabel("Start Date:")); runControls.add(this.startDateField); runControls.add(new JLabel(" End Date:")); runControls.add(this.endDateField); runControls.add(new JLabel(" Strategy:")); runControls.add(this.strategyField); runControls.add(this.editButton); runControls.add(this.compileButton); } simControlsPanel.add(runControls); } simPanel.add(simControlsPanel, BorderLayout.CENTER); } controls.add(simPanel); } content.add(controls, BorderLayout.NORTH); JSplitPane vSplit = this.vSplit; { vSplit.setResizeWeight(0.5); vSplit.add(this.chartPanel, JSplitPane.TOP); JSplitPane hSplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); { hSplit.setResizeWeight(0.5); // enough for no hscrollbar in 1024 width JSplitPane reportSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT); { reportSplit.setResizeWeight(0.5); JScrollPane reportScroll = new JScrollPane(this.reportArea); { reportScroll.setBorder(BorderFactory.createTitledBorder("Report")); } reportSplit.add(reportScroll, JSplitPane.TOP); JScrollPane monthScroll = new JScrollPane(this.monthlyLogArea); { monthScroll.setBorder(BorderFactory.createTitledBorder("Monthly Log")); } reportSplit.add(monthScroll, JSplitPane.BOTTOM); } hSplit.add(reportSplit, JSplitPane.LEFT); JScrollPane tradeScroll = new JScrollPane(this.tradeLogArea); { tradeScroll.setBorder(BorderFactory.createTitledBorder("Trade Log")); } hSplit.add(tradeScroll, JSplitPane.RIGHT); } vSplit.add(hSplit, JSplitPane.BOTTOM); } content.add(vSplit, BorderLayout.CENTER); }
From source file:shuffle.fwk.service.teams.EditTeamService.java
@SuppressWarnings("serial") private Component makeTeamPanel() { JPanel firstOptionRow = new JPanel(new GridBagLayout()); GridBagConstraints rowc = new GridBagConstraints(); rowc.fill = GridBagConstraints.HORIZONTAL; rowc.weightx = 0.0;/*from w w w .j a v a 2 s . com*/ rowc.weighty = 0.0; rowc.weightx = 1.0; rowc.gridx = 1; stageChooser = new StageChooser(this); firstOptionRow.add(stageChooser, rowc); rowc.weightx = 0.0; JPanel secondOptionRow = new JPanel(new GridBagLayout()); rowc.gridx = 1; JLabel megaLabel = new JLabel(getString(KEY_MEGA_LABEL)); megaLabel.setToolTipText(getString(KEY_MEGA_TOOLTIP)); secondOptionRow.add(megaLabel, rowc); rowc.gridx = 2; megaChooser = new JComboBox<String>(); megaChooser.setToolTipText(getString(KEY_MEGA_TOOLTIP)); secondOptionRow.add(megaChooser, rowc); rowc.gridx = 3; JPanel progressPanel = new JPanel(new BorderLayout()); megaActive = new JCheckBox(getString(KEY_ACTIVE)); megaActive.setSelected(false); megaActive.setToolTipText(getString(KEY_ACTIVE_TOOLTIP)); progressPanel.add(megaActive, BorderLayout.WEST); megaProgressChooser = new JComboBox<Integer>(); progressPanel.add(megaProgressChooser, BorderLayout.EAST); megaProgressChooser.setToolTipText(getString(KEY_MEGA_PROGRESS_TOOLTIP)); secondOptionRow.add(progressPanel, rowc); JPanel thirdOptionRow = new JPanel(new GridBagLayout()); rowc.gridx = 1; JButton clearTeamButton = new JButton(getString(KEY_CLEAR_TEAM)); clearTeamButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { clearTeam(); } }); clearTeamButton.setToolTipText(getString(KEY_CLEAR_TEAM_TOOLTIP)); thirdOptionRow.add(clearTeamButton, rowc); rowc.gridx = 2; woodCheckBox = new JCheckBox(getString(KEY_WOOD)); woodCheckBox.setToolTipText(getString(KEY_WOOD_TOOLTIP)); thirdOptionRow.add(woodCheckBox, rowc); rowc.gridx = 3; metalCheckBox = new JCheckBox(getString(KEY_METAL)); metalCheckBox.setToolTipText(getString(KEY_METAL_TOOLTIP)); thirdOptionRow.add(metalCheckBox, rowc); rowc.gridx = 4; coinCheckBox = new JCheckBox(getString(KEY_COIN)); coinCheckBox.setToolTipText(getString(KEY_COIN_TOOLTIP)); thirdOptionRow.add(coinCheckBox, rowc); rowc.gridx = 5; freezeCheckBox = new JCheckBox(getString(KEY_FREEZE)); freezeCheckBox.setToolTipText(getString(KEY_FREEZE_TOOLTIP)); thirdOptionRow.add(freezeCheckBox, rowc); JPanel topPart = new JPanel(new GridBagLayout()); GridBagConstraints topC = new GridBagConstraints(); topC.fill = GridBagConstraints.HORIZONTAL; topC.weightx = 0.0; topC.weighty = 0.0; topC.gridx = 1; topC.gridy = 1; topC.gridwidth = 1; topC.gridheight = 1; topC.anchor = GridBagConstraints.CENTER; topC.gridy = 1; topPart.add(firstOptionRow, topC); topC.gridy = 2; topPart.add(secondOptionRow, topC); topC.gridy = 3; topPart.add(thirdOptionRow, topC); addOptionListeners(); teamPanel = new JPanel(new WrapLayout()) { // Fix to make it play nice with the scroll bar. @Override public Dimension getPreferredSize() { Dimension d = super.getPreferredSize(); d.width = (int) (d.getWidth() - 20); return d; } }; final JScrollPane scrollPane = new JScrollPane(teamPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER) { @Override public Dimension getMinimumSize() { Dimension d = super.getMinimumSize(); d.width = topPart.getMinimumSize().width; d.height = rosterScrollPane.getPreferredSize().height - topPart.getPreferredSize().height; return d; } @Override public Dimension getPreferredSize() { Dimension d = super.getPreferredSize(); d.width = topPart.getMinimumSize().width; d.height = rosterScrollPane.getPreferredSize().height - topPart.getPreferredSize().height; return d; } }; scrollPane.addComponentListener(new ComponentAdapter() { @Override public void componentResized(ComponentEvent e) { scrollPane.revalidate(); } }); scrollPane.getVerticalScrollBar().setUnitIncrement(27); JPanel ret = new JPanel(new GridBagLayout()); GridBagConstraints rc = new GridBagConstraints(); rc.fill = GridBagConstraints.VERTICAL; rc.weightx = 0.0; rc.weighty = 0.0; rc.gridx = 1; rc.gridy = 1; rc.insets = new Insets(5, 5, 5, 5); ret.add(topPart, rc); rc.gridy += 1; rc.weightx = 0.0; rc.weighty = 1.0; rc.insets = new Insets(0, 0, 0, 0); ret.add(scrollPane, rc); return ret; }