List of usage examples for javax.swing JSplitPane setResizeWeight
@BeanProperty(description = "Specifies how to distribute extra space when the split pane resizes.") public void setResizeWeight(double value)
From source file:com.diversityarrays.kdxplore.curate.TrialDataEditor.java
private JSplitPane createStatsAndSamplesTable(JComponent top) { curationTableModel.addPropertyChangeListener(CurationTableModel.PROPERTY_TRAIT_INSTANCES, traitInstancesChanged);/* w w w . java 2s .co m*/ onlyUneditedCheckbox.addActionListener(filtersActionListener); hideInactivePlots.addActionListener(filtersActionListener); if (onlyRowsWithScoresCheckbox != null) { onlyRowsWithScoresCheckbox.addActionListener(filtersActionListener); onlyRowsWithScoresCheckbox.setEnabled(curationTableModel.hasAnyTraitInstanceColumns()); } JComponent tagFilters = null; if (!curationData.getSortedTagLabels().isEmpty()) { tagFilters = tagLabelFiltersButton; } JComponent posFilters = null; if (curationData.hasAnySpecimens()) { updatePlotSpecimenIcon(); posFilters = plotOrSpecimenFilterButton; } plotOrSpecimenFilterAction.putValue(Action.LARGE_ICON_KEY, inactivePlotOrSpecimenFilterIcon); plotOrSpecimenFilterAction.putValue(Action.SHORT_DESCRIPTION, "Filter on Plot/Specimen"); tagLabelFiltersAction.putValue(Action.LARGE_ICON_KEY, inactiveTagFilterIcon); tagLabelFiltersAction.putValue(Action.SHORT_DESCRIPTION, "Filter on Tags"); curationTablePanel = new TitledTablePanelWithResizeControls(SAMPLES_TABLE_NAME, curationTable, smallFont, hideInactivePlots, onlyUneditedCheckbox, onlyRowsWithScoresCheckbox, tagFilters, posFilters, new JButton(curationHelpAction)); // curationTablePanel.scrollPane.setCorner(JScrollPane.UPPER_RIGHT_CORNER, // makeUndockButton()); Transformer<TraitInstance, Color> traitInstanceColorProvider = new Transformer<TraitInstance, Color>() { @Override public Color transform(TraitInstance ti) { ColorPair cp = colorProviderFactory.get().getTraitInstanceColor(ti); return cp.getBackground(); } }; markerPanelManager = new MarkerPanelManager(curationData.getTrial(), curationTableModel, curationTable, curationTablePanel, traitInstanceColorProvider, curationTableSelectionModel); // fieldViewIcon = KDClientUtils.getIcon(ImageId.FIELD_VIEW_24); samplesTableIcon = KDClientUtils.getIcon(ImageId.TABLE_24); JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, top, curationTablePanel); splitPane.setResizeWeight(0.3); splitPane.setOneTouchExpandable(true); return splitPane; }
From source file:org.jets3t.apps.cockpit.Cockpit.java
/** * Initialises the application's GUI elements. */// w w w.j a v a 2s . c o m private void initGui() { initMenus(); JPanel appContent = new JPanel(new GridBagLayout()); this.getContentPane().add(appContent); // Buckets panel. JPanel bucketsPanel = new JPanel(new GridBagLayout()); JButton bucketActionButton = new JButton(); bucketActionButton.setToolTipText("Bucket actions menu"); guiUtils.applyIcon(bucketActionButton, "/images/nuvola/16x16/actions/misc.png"); bucketActionButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JButton sourceButton = (JButton) e.getSource(); bucketActionMenu.show(sourceButton, 0, sourceButton.getHeight()); } }); bucketsPanel.add(new JHtmlLabel("<html><b>Buckets</b></html>", this), new GridBagConstraints(0, 0, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insetsZero, 0, 0)); bucketsPanel.add(bucketActionButton, new GridBagConstraints(1, 0, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, insetsZero, 0, 0)); bucketTableModel = new BucketTableModel(false); bucketTableModelSorter = new TableSorter(bucketTableModel); bucketsTable = new JTable(bucketTableModelSorter); bucketTableModelSorter.setTableHeader(bucketsTable.getTableHeader()); bucketsTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); bucketsTable.getSelectionModel().addListSelectionListener(this); bucketsTable.setShowHorizontalLines(true); bucketsTable.setShowVerticalLines(false); bucketsTable.addMouseListener(new ContextMenuListener()); bucketsPanel.add(new JScrollPane(bucketsTable), new GridBagConstraints(0, 1, 2, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, insetsZero, 0, 0)); bucketsPanel.add(new JLabel(" "), new GridBagConstraints(0, 2, 2, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, insetsDefault, 0, 0)); // Filter panel. filterObjectsPanel = new JPanel(new GridBagLayout()); filterObjectsPrefix = new JTextField(); filterObjectsPrefix.setToolTipText("Only show objects with this prefix"); filterObjectsPrefix.addActionListener(this); filterObjectsPrefix.setActionCommand("RefreshObjects"); filterObjectsDelimiter = new JComboBox(new String[] { "", "/", "?", "\\" }); filterObjectsDelimiter.setEditable(true); filterObjectsDelimiter.setToolTipText("Object name delimiter"); filterObjectsDelimiter.addActionListener(this); filterObjectsDelimiter.setActionCommand("RefreshObjects"); filterObjectsPanel.add(new JHtmlLabel("Prefix:", this), new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, insetsZero, 0, 0)); filterObjectsPanel.add(filterObjectsPrefix, new GridBagConstraints(1, 0, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); filterObjectsPanel.add(new JHtmlLabel("Delimiter:", this), new GridBagConstraints(2, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, insetsDefault, 0, 0)); filterObjectsPanel.add(filterObjectsDelimiter, new GridBagConstraints(3, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, insetsZero, 0, 0)); filterObjectsPanel.setVisible(false); // Objects panel. JPanel objectsPanel = new JPanel(new GridBagLayout()); int row = 0; filterObjectsCheckBox = new JCheckBox("Filter objects"); filterObjectsCheckBox.addActionListener(this); filterObjectsCheckBox.setToolTipText("Check this option to filter the objects listed"); objectsPanel.add(new JHtmlLabel("<html><b>Objects</b></html>", this), new GridBagConstraints(0, row, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insetsZero, 0, 0)); objectsPanel.add(filterObjectsCheckBox, new GridBagConstraints(1, row, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, insetsZero, 0, 0)); JButton objectActionButton = new JButton(); objectActionButton.setToolTipText("Object actions menu"); guiUtils.applyIcon(objectActionButton, "/images/nuvola/16x16/actions/misc.png"); objectActionButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JButton sourceButton = (JButton) e.getSource(); objectActionMenu.show(sourceButton, 0, sourceButton.getHeight()); } }); objectsPanel.add(objectActionButton, new GridBagConstraints(2, row, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, insetsZero, 0, 0)); objectsPanel.add(filterObjectsPanel, new GridBagConstraints(0, ++row, 3, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insetsZero, 0, 0)); objectsTable = new JTable(); objectTableModel = new ObjectTableModel(); objectTableModelSorter = new TableSorter(objectTableModel); objectTableModelSorter.setTableHeader(objectsTable.getTableHeader()); objectsTable.setModel(objectTableModelSorter); objectsTable.setDefaultRenderer(Long.class, new DefaultTableCellRenderer() { private static final long serialVersionUID = 301092191828910402L; @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { String formattedSize = byteFormatter.formatByteSize(((Long) value).longValue()); return super.getTableCellRendererComponent(table, formattedSize, isSelected, hasFocus, row, column); } }); objectsTable.setDefaultRenderer(Date.class, new DefaultTableCellRenderer() { private static final long serialVersionUID = 7285511556343895652L; @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { Date date = (Date) value; return super.getTableCellRendererComponent(table, yearAndTimeSDF.format(date), isSelected, hasFocus, row, column); } }); objectsTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); objectsTable.getSelectionModel().addListSelectionListener(this); objectsTable.setShowHorizontalLines(true); objectsTable.setShowVerticalLines(true); objectsTable.addMouseListener(new ContextMenuListener()); objectsTableSP = new JScrollPane(objectsTable); objectsPanel.add(objectsTableSP, new GridBagConstraints(0, ++row, 3, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, insetsZero, 0, 0)); objectsSummaryLabel = new JHtmlLabel("Please select a bucket", this); objectsSummaryLabel.setHorizontalAlignment(JLabel.CENTER); objectsSummaryLabel.setFocusable(false); objectsPanel.add(objectsSummaryLabel, new GridBagConstraints(0, ++row, 3, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); // Combine sections. JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, bucketsPanel, objectsPanel); splitPane.setOneTouchExpandable(true); splitPane.setContinuousLayout(true); appContent.add(splitPane, new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, insetsDefault, 0, 0)); // Set preferred sizes int preferredWidth = 800; int preferredHeight = 600; this.setBounds(new Rectangle(new Dimension(preferredWidth, preferredHeight))); splitPane.setResizeWeight(0.30); // Initialize drop target. initDropTarget(new JComponent[] { objectsTableSP, objectsTable }); objectsTable.getDropTarget().setActive(false); objectsTableSP.getDropTarget().setActive(false); }
From source file:ome.formats.importer.gui.FileQueueHandler.java
/** * @param scanEx ScheduledExecutorService for scanning * @param importEx ScheduledExecutorService for importing * @param viewer Parent viewer class//from ww w . j a v a 2 s.com * @param config ImportConfig */ FileQueueHandler(ScheduledExecutorService scanEx, ScheduledExecutorService importEx, GuiImporter viewer, ImportConfig config) { this.scanEx = scanEx; this.importEx = importEx; this.config = config; this.viewer = viewer; this.historyTable = viewer.getHistoryTable(); this.importReader = new OMEROWrapper(config); this.scanReader = new OMEROWrapper(config); //reader.setChannelStatCalculationStatus(true); setLayout(new BorderLayout()); fileChooser = new FileQueueChooser(config, scanReader); fileChooser.addActionListener(this); fileChooser.addPropertyChangeListener(this); qTable = new FileQueueTable(); qTable.addPropertyChangeListener(this); // Functionality to allows the reimport button to work if (historyTable != null) { historyTable.addObserver(this); addPropertyChangeListener(historyTable); } JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, fileChooser, qTable); splitPane.setResizeWeight(0.1); add(splitPane, BorderLayout.CENTER); }
From source file:org.apache.jmeter.gui.MainFrame.java
/** * Create the GUI components and layout. */// w w w . j a v a 2 s .c om private void init() { // WARNING: called from ctor so must not be overridden (i.e. must be private or final) menuBar = new JMeterMenuBar(); setJMenuBar(menuBar); JPanel all = new JPanel(new BorderLayout()); all.add(createToolBar(), BorderLayout.NORTH); JSplitPane treeAndMain = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); treePanel = createTreePanel(); treeAndMain.setLeftComponent(treePanel); JSplitPane topAndDown = new JSplitPane(JSplitPane.VERTICAL_SPLIT); topAndDown.setOneTouchExpandable(true); topAndDown.setDividerLocation(0.8); topAndDown.setResizeWeight(.8); topAndDown.setContinuousLayout(true); topAndDown.setBorder(null); // see bug jdk 4131528 if (!DISPLAY_LOGGER_PANEL) { topAndDown.setDividerSize(0); } mainPanel = createMainPanel(); logPanel = createLoggerPanel(); errorsAndFatalsCounterLogTarget = new ErrorsAndFatalsCounterLogTarget(); LoggingManager.addLogTargetToRootLogger(new LogTarget[] { logPanel, errorsAndFatalsCounterLogTarget }); topAndDown.setTopComponent(mainPanel); topAndDown.setBottomComponent(logPanel); treeAndMain.setRightComponent(topAndDown); treeAndMain.setResizeWeight(.2); treeAndMain.setContinuousLayout(true); all.add(treeAndMain, BorderLayout.CENTER); getContentPane().add(all); tree.setSelectionRow(1); addWindowListener(new WindowHappenings()); // Building is complete, register as listener GuiPackage.getInstance().registerAsListener(); setTitle(DEFAULT_TITLE); setIconImage(JMeterUtils.getImage("icon-apache.png").getImage());// $NON-NLS-1$ setWindowTitle(); // define AWT WM_CLASS string }
From source file:org.apache.jmeter.protocol.http.visualizers.RequestViewHTTP.java
/** * Create a pane with three tables (request, params, headers) * /* w w w . j a va2 s. c o m*/ * @return Pane to display request data */ private Component createRequestPane() { // Set up the 1st table Result with empty headers tableRequest = new JTable(requestModel); JMeterUtils.applyHiDPI(tableRequest); tableRequest.setToolTipText(JMeterUtils.getResString("textbox_tooltip_cell")); // $NON-NLS-1$ tableRequest.addMouseListener(new TextBoxDoubleClick(tableRequest)); setFirstColumnPreferredAndMaxWidth(tableRequest); RendererUtils.applyRenderers(tableRequest, RENDERERS_REQUEST); // Set up the 2nd table tableParams = new JTable(paramsModel); JMeterUtils.applyHiDPI(tableParams); tableParams.setToolTipText(JMeterUtils.getResString("textbox_tooltip_cell")); // $NON-NLS-1$ tableParams.addMouseListener(new TextBoxDoubleClick(tableParams)); TableColumn column = tableParams.getColumnModel().getColumn(0); column.setPreferredWidth(160); tableParams.getTableHeader().setDefaultRenderer(new HeaderAsPropertyRenderer()); RendererUtils.applyRenderers(tableParams, RENDERERS_PARAMS); // Set up the 3rd table tableHeaders = new JTable(headersModel); JMeterUtils.applyHiDPI(tableHeaders); tableHeaders.setToolTipText(JMeterUtils.getResString("textbox_tooltip_cell")); // $NON-NLS-1$ tableHeaders.addMouseListener(new TextBoxDoubleClick(tableHeaders)); setFirstColumnPreferredAndMaxWidth(tableHeaders); tableHeaders.getTableHeader().setDefaultRenderer(new HeaderAsPropertyRenderer()); RendererUtils.applyRenderers(tableHeaders, RENDERERS_HEADERS); // Create the split pane JSplitPane topSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT, GuiUtils.makeScrollPane(tableParams), GuiUtils.makeScrollPane(tableHeaders)); topSplit.setOneTouchExpandable(true); topSplit.setResizeWeight(0.50); // set split ratio topSplit.setBorder(null); // see bug jdk 4131528 JSplitPane paneParsed = new JSplitPane(JSplitPane.VERTICAL_SPLIT, GuiUtils.makeScrollPane(tableRequest), topSplit); paneParsed.setOneTouchExpandable(true); paneParsed.setResizeWeight(0.25); // set split ratio (only 5 lines to display) paneParsed.setBorder(null); // see bug jdk 4131528 // Hint to background color on bottom tabs (grey, not blue) JPanel panel = new JPanel(new BorderLayout()); panel.add(paneParsed); return panel; }
From source file:org.eurocarbdb.application.glycoworkbench.plugin.s3.Cockpit.java
/** * Initialises the application's GUI elements. *//*from www. ja v a 2 s. c om*/ private void initGui() { initMenus(); JPanel appContent = new JPanel(new GridBagLayout()); this.getContentPane().add(appContent); // Buckets panel. JPanel bucketsPanel = new JPanel(new GridBagLayout()); JButton bucketActionButton = new JButton(); bucketActionButton.setToolTipText("Bucket actions menu"); guiUtils.applyIcon(bucketActionButton, "/images/nuvola/16x16/actions/misc.png"); bucketActionButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JButton sourceButton = (JButton) e.getSource(); bucketActionMenu.show(sourceButton, 0, sourceButton.getHeight()); } }); bucketsPanel.add(new JHtmlLabel("<html><b>Buckets</b></html>", this), new GridBagConstraints(0, 0, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insetsZero, 0, 0)); bucketsPanel.add(bucketActionButton, new GridBagConstraints(1, 0, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, insetsZero, 0, 0)); bucketTableModel = new BucketTableModel(false); bucketTableModelSorter = new TableSorter(bucketTableModel); bucketsTable = new JTable(bucketTableModelSorter); bucketTableModelSorter.setTableHeader(bucketsTable.getTableHeader()); bucketsTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); bucketsTable.getSelectionModel().addListSelectionListener(this); bucketsTable.setShowHorizontalLines(true); bucketsTable.setShowVerticalLines(false); bucketsTable.addMouseListener(new ContextMenuListener()); bucketsPanel.add(new JScrollPane(bucketsTable), new GridBagConstraints(0, 1, 2, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, insetsZero, 0, 0)); bucketsPanel.add(new JLabel(" "), new GridBagConstraints(0, 2, 2, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, insetsDefault, 0, 0)); // Filter panel. filterObjectsPanel = new JPanel(new GridBagLayout()); filterObjectsPrefix = new JTextField(); filterObjectsPrefix.setToolTipText("Only show objects with this prefix"); filterObjectsPrefix.addActionListener(this); filterObjectsPrefix.setActionCommand("RefreshObjects"); filterObjectsDelimiter = new JComboBox(new String[] { "", "/", "?", "\\" }); filterObjectsDelimiter.setEditable(true); filterObjectsDelimiter.setToolTipText("Object name delimiter"); filterObjectsDelimiter.addActionListener(this); filterObjectsDelimiter.setActionCommand("RefreshObjects"); filterObjectsPanel.add(new JHtmlLabel("Prefix:", this), new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, insetsZero, 0, 0)); filterObjectsPanel.add(filterObjectsPrefix, new GridBagConstraints(1, 0, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); filterObjectsPanel.add(new JHtmlLabel("Delimiter:", this), new GridBagConstraints(2, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, insetsDefault, 0, 0)); filterObjectsPanel.add(filterObjectsDelimiter, new GridBagConstraints(3, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, insetsZero, 0, 0)); filterObjectsPanel.setVisible(false); // Objects panel. JPanel objectsPanel = new JPanel(new GridBagLayout()); int row = 0; filterObjectsCheckBox = new JCheckBox("Filter objects"); filterObjectsCheckBox.addActionListener(this); filterObjectsCheckBox.setToolTipText("Check this option to filter the objects listed"); objectsPanel.add(new JHtmlLabel("<html><b>Objects</b></html>", this), new GridBagConstraints(0, row, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insetsZero, 0, 0)); objectsPanel.add(filterObjectsCheckBox, new GridBagConstraints(1, row, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, insetsZero, 0, 0)); JButton objectActionButton = new JButton(); objectActionButton.setToolTipText("Object actions menu"); guiUtils.applyIcon(objectActionButton, "/images/nuvola/16x16/actions/misc.png"); objectActionButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JButton sourceButton = (JButton) e.getSource(); objectActionMenu.show(sourceButton, 0, sourceButton.getHeight()); } }); objectsPanel.add(objectActionButton, new GridBagConstraints(2, row, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, insetsZero, 0, 0)); objectsPanel.add(filterObjectsPanel, new GridBagConstraints(0, ++row, 3, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insetsZero, 0, 0)); objectsTable = new JTable(); objectTableModel = new ObjectTableModel(); objectTableModelSorter = new TableSorter(objectTableModel); objectTableModelSorter.setTableHeader(objectsTable.getTableHeader()); objectsTable.setModel(objectTableModelSorter); objectsTable.setDefaultRenderer(Long.class, new DefaultTableCellRenderer() { private static final long serialVersionUID = 301092191828910402L; public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { String formattedSize = byteFormatter.formatByteSize(((Long) value).longValue()); return super.getTableCellRendererComponent(table, formattedSize, isSelected, hasFocus, row, column); } }); objectsTable.setDefaultRenderer(Date.class, new DefaultTableCellRenderer() { private static final long serialVersionUID = 7285511556343895652L; public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { Date date = (Date) value; return super.getTableCellRendererComponent(table, yearAndTimeSDF.format(date), isSelected, hasFocus, row, column); } }); objectsTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); objectsTable.getSelectionModel().addListSelectionListener(this); objectsTable.setShowHorizontalLines(true); objectsTable.setShowVerticalLines(true); objectsTable.addMouseListener(new ContextMenuListener()); objectsTableSP = new JScrollPane(objectsTable); objectsPanel.add(objectsTableSP, new GridBagConstraints(0, ++row, 3, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, insetsZero, 0, 0)); objectsSummaryLabel = new JHtmlLabel("Please select a bucket", this); objectsSummaryLabel.setHorizontalAlignment(JLabel.CENTER); objectsSummaryLabel.setFocusable(false); objectsPanel.add(objectsSummaryLabel, new GridBagConstraints(0, ++row, 3, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); // Combine sections. JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, bucketsPanel, objectsPanel); splitPane.setOneTouchExpandable(true); splitPane.setContinuousLayout(true); appContent.add(splitPane, new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, insetsDefault, 0, 0)); // Set preferred sizes int preferredWidth = 800; int preferredHeight = 600; this.setBounds(new Rectangle(new Dimension(preferredWidth, preferredHeight))); splitPane.setResizeWeight(0.30); // Initialize drop target. initDropTarget(new JComponent[] { objectsTableSP, objectsTable }); objectsTable.getDropTarget().setActive(false); objectsTableSP.getDropTarget().setActive(false); }
From source file:org.executequery.gui.editor.ManageShortcutsPanel.java
private JSplitPane createSplitPane() { JSplitPane splitPane = new FlatSplitPane(JSplitPane.VERTICAL_SPLIT); splitPane.setDividerSize(4);/*from w w w .j a v a2 s. co m*/ splitPane.setResizeWeight(0.5); splitPane.setDividerLocation(0.5); return splitPane; }
From source file:org.executequery.gui.ExecuteProcedurePanel.java
private void init() throws Exception { tableModel = new ParameterTableModel(); table = new DefaultTable(tableModel); table.getTableHeader().setReorderingAllowed(false); table.setCellSelectionEnabled(true); table.setColumnSelectionAllowed(false); table.setRowSelectionAllowed(false); connectionsCombo = WidgetFactory.createComboBox(); schemaCombo = WidgetFactory.createComboBox(); combosGroup = new TableSelectionCombosGroup(connectionsCombo, schemaCombo, null); combosGroup.addItemSelectionListener(this); objectTypeCombo = WidgetFactory.createComboBox(createAvailableObjectTypes()); objectTypeCombo.setToolTipText("Select the database object type"); objectTypeCombo.addItemListener(this); proceduresModel = new DynamicComboBoxModel(); procedureCombo = WidgetFactory.createComboBox(proceduresModel); procedureCombo.setActionCommand("procedureSelectionChanged"); procedureCombo.setToolTipText("Select the database object name"); procedureCombo.addActionListener(this); JPanel base = new JPanel(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.insets = new Insets(5, 7, 5, 8); gbc.anchor = GridBagConstraints.NORTHWEST; gbc.fill = GridBagConstraints.BOTH; gbc.gridy++;/*from w w w .j a v a 2s .c o m*/ base.add(new JLabel("Connection:"), gbc); gbc.gridx = 1; gbc.weightx = 1.0; gbc.insets.left = 0; base.add(connectionsCombo, gbc); gbc.gridx = 0; gbc.weightx = 0; gbc.gridy++; gbc.insets.left = 7; gbc.insets.top = 0; base.add(new JLabel("Schema:"), gbc); gbc.gridx = 1; gbc.weightx = 1.0; gbc.insets.left = 0; base.add(schemaCombo, gbc); gbc.gridx = 0; gbc.weightx = 0; gbc.gridy++; gbc.insets.left = 7; gbc.insets.top = 0; base.add(new JLabel("Object Type:"), gbc); gbc.gridx = 1; gbc.weightx = 1.0; gbc.insets.left = 0; base.add(objectTypeCombo, gbc); gbc.gridx = 0; gbc.weightx = 0; gbc.gridy++; gbc.insets.left = 7; base.add(new JLabel("Object Name:"), gbc); gbc.gridx = 1; gbc.weightx = 1.0; gbc.insets.left = 0; base.add(procedureCombo, gbc); resultsPanel = new QueryEditorResultsPanel(); JPanel resultsBase = new JPanel(new BorderLayout()); resultsBase.add(resultsPanel, BorderLayout.CENTER); JSplitPane splitPane = new SplitPaneFactory().create(JSplitPane.VERTICAL_SPLIT, new JScrollPane(table), resultsBase); splitPane.setResizeWeight(0.5); splitPane.setDividerLocation(0.75); splitPane.setDividerSize(5); gbc.gridy++; gbc.gridx = 0; gbc.weighty = 1.0; gbc.insets.left = 7; gbc.gridwidth = GridBagConstraints.REMAINDER; base.add(splitPane, gbc); JButton executeButton = ActionUtilities.createButton(this, "Execute", "execute"); gbc.gridy++; gbc.weighty = 0; gbc.fill = GridBagConstraints.NONE; gbc.anchor = GridBagConstraints.EAST; gbc.insets.top = 0; gbc.insets.bottom = 20; base.add(executeButton, gbc); base.setBorder(BorderFactory.createEtchedBorder()); setBorder(BorderFactory.createEmptyBorder(5, 5, 7, 5)); add(base, BorderLayout.CENTER); EventMediator.registerListener(this); connectionSelectionMade(); }
From source file:org.jcurl.demo.smack.JCurlSmackClient.java
@Override protected void startup() { getMainFrame().setJMenuBar(createMenuBar()); miRoster.setSelected(true);/*from w ww. j a v a 2 s .c o m*/ final JComponent pv = new JPanel(); pv.setLayout(new BorderLayout()); final Box conversation = Box.createVerticalBox(); pv.add(new JScrollPane(conversation, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED), BorderLayout.CENTER); pv.add(new JScrollPane(sca, ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS), BorderLayout.SOUTH); final JSplitPane ph = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); ph.setResizeWeight(0.8); ph.add(pv, JSplitPane.LEFT); ph.add(new JScrollPane(sro), JSplitPane.RIGHT); xmppRoster(); show(ph); // connect the jabber account new Thread(new Runnable() { public void run() { try { // get uid + pwd from a .properties file final Properties p = loadClassProps(JCurlSmackClient.class, null); acc.setUid(XmppAddress.parse(p.getProperty("acc_uid"))); acc.setPwd(p.getProperty("acc_pwd")); // login and get the present buddies acc.login(resource); SwingUtilities.invokeLater(new Runnable() { public void run() { sro.setConn(acc.getConn()); // Wire up xmpp stuff: final ChatManager cm = sro.getChatManager(); cm.addChatListener(sca); cm.addChatListener(slo); } }); } catch (final IOException e) { throw new RuntimeException("Unhandled", e); } catch (final XMPPException e) { throw new RuntimeException("Unhandled", e); } } }).start(); }
From source file:org.lnicholls.galleon.gui.MainFrame.java
public static JSplitPane createSplitPane(int orientation, Component comp1, Component comp2, double resizeWeight) { JSplitPane split = new JSplitPane(1, false, comp1, comp2); split.setBorder(new EmptyBorder(0, 0, 0, 0)); split.setOneTouchExpandable(false);/*w w w . j a v a2 s . c om*/ split.setResizeWeight(resizeWeight); return split; }