List of usage examples for javax.swing JSplitPane setContinuousLayout
@BeanProperty(description = "Whether the child components are continuously redisplayed and laid out during user intervention.") public void setContinuousLayout(boolean newContinuousLayout)
continuousLayout
property, which must be true
for the child components to be continuously redisplayed and laid out during user intervention. From source file:de.codesourcery.eve.skills.ui.components.impl.ImportMarketLogFileComponent.java
private JPanel createSplitPanePanel(JComponent top, JScrollPane bottom) { final JScrollPane resultPane = new JScrollPane(top); resultPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER); resultPane.setMinimumSize(new Dimension(400, 150)); resultPane.setPreferredSize(new Dimension(600, 200)); bottom.setMinimumSize(new Dimension(100, 200)); bottom.setPreferredSize(new Dimension(600, 300)); final JSplitPane pane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, top, bottom); // pane.setResizeWeight( 0.5 ); pane.setDividerLocation(200);//from w w w.j av a2 s .c o m pane.setContinuousLayout(true); final JPanel contentPanel = new JPanel(); contentPanel.setLayout(new BorderLayout()); contentPanel.add(pane); return contentPanel; }
From source file:de.codesourcery.eve.skills.ui.components.impl.MarketPriceEditorComponent.java
@Override protected JPanel createPanel() { // add search textfield final JPanel inputPanel = new JPanel(); inputPanel.setBorder(lineBorder(Color.black)); inputPanel.setLayout(new GridBagLayout()); inputPanel.add(itemNameFilter.getPanel(), constraints(0, 0).anchorWest().noResizing().end()); importMarketLogButton.addActionListener(new ActionListener() { @Override// w ww .j a va 2 s . c om public void actionPerformed(ActionEvent e) { importMarketLogs(); } }); inputPanel.add(importMarketLogButton, constraints(0, 1).anchorWest().noResizing().end()); // add item description text area selectedItemDescription.setEditable(false); selectedItemDescription.setWrapStyleWord(true); selectedItemDescription.setLineWrap(true); final JScrollPane selectedItemDescPanel = new JScrollPane(selectedItemDescription); selectedItemDescPanel.setBorder(BorderFactory.createTitledBorder("Selected item")); // setup table tableModel.setViewFilter(this.itemNameFilter.getViewFilter()); table.setModel(tableModel); table.setRowSorter(tableModel.getRowSorter()); table.setDefaultRenderer(String.class, new StalePriceInfoHighlighter()); table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); table.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { final int viewRow = table.getSelectedRow(); if (viewRow != -1) { final int modelRow = table.convertRowIndexToModel(viewRow); updateItemDescriptionDisplay(modelRow); } } } }); table.setFillsViewportHeight(true); table.addMouseListener(popupListener); table.setFillsViewportHeight(true); // setup split pane final JPanel result = new JPanel(); final JPanel topPanel = new JPanel(); new GridLayoutBuilder().add(new GridLayoutBuilder.HorizontalGroup(new GridLayoutBuilder.Cell(inputPanel), new GridLayoutBuilder.Cell(selectedItemDescPanel))).addTo(topPanel); final JSplitPane pane = new ImprovedSplitPane(JSplitPane.VERTICAL_SPLIT, topPanel, tablePane); pane.setDividerLocation(0.3d); // only works because of the splitpane // hack pane.setContinuousLayout(true); result.setLayout(new GridBagLayout()); result.add(pane, constraints().resizeBoth().useRemainingSpace().end()); return result; }
From source file:edu.ucla.stat.SOCR.applications.demo.PortfolioApplication2.java
public void init() { // dataPoints = new LinkedList(); t1_x = t2_x = 0;/* w w w. j a v a2 s . c o m*/ t1_y = t2_y = 0.001; simulatedPoints = setupUniformSimulate(numStocks, numSimulate); tabbedPanelContainer = new JTabbedPane(); show_tangent = true; // addGraph(chartPanel); // addToolbar(sliderPanel); initGraphPanel(); initMixPanel(); initInputPanel(); emptyTool(); emptyTool2(); leftControl = new JPanel(); leftControl.setLayout(new BoxLayout(leftControl, BoxLayout.PAGE_AXIS)); addRadioButton2Left("Number of Stocks:", "", numStocksArray, numStocks - 2, this); addRadioButton2Left("Show Tangent Line :", "", on_off, 0, this); JScrollPane mixPanelContainer = new JScrollPane(mixPanel); mixPanelContainer.setPreferredSize(new Dimension(600, CHART_SIZE_Y + 100)); addTabbedPane(GRAPH, graphPanel); addTabbedPane(INPUT, inputPanel); addTabbedPane(ALL, mixPanelContainer); setChart(); tabbedPanelContainer.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { if (tabbedPanelContainer.getTitleAt(tabbedPanelContainer.getSelectedIndex()) == ALL) { mixPanel.removeAll(); setMixPanel(); mixPanel.validate(); } else if (tabbedPanelContainer.getTitleAt(tabbedPanelContainer.getSelectedIndex()) == GRAPH) { graphPanel.removeAll(); setChart(); } else if (tabbedPanelContainer.getTitleAt(tabbedPanelContainer.getSelectedIndex()) == INPUT) { // setInputPanel(); } } }); statusTextArea = new JTextPane(); //right side lower statusTextArea.setEditable(false); JScrollPane statusContainer = new JScrollPane(statusTextArea); statusContainer.setPreferredSize(new Dimension(600, 140)); JSplitPane upContainer = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, new JScrollPane(leftControl), new JScrollPane(tabbedPanelContainer)); this.getMainPanel().removeAll(); if (SHOW_STATUS_TEXTAREA) { JSplitPane container = new JSplitPane(JSplitPane.VERTICAL_SPLIT, new JScrollPane(upContainer), statusContainer); container.setContinuousLayout(true); container.setDividerLocation(0.6); this.getMainPanel().add(container, BorderLayout.CENTER); } else { this.getMainPanel().add(new JScrollPane(upContainer), BorderLayout.CENTER); } this.getMainPanel().validate(); }
From source file:com.vgi.mafscaling.LogView.java
private void createDataTab() { JPanel dataPanel = new JPanel(new BorderLayout()); add(dataPanel, "<html><div style='text-align: center;'>D<br>a<br>t<br>a</div></html>"); createToolBar(dataPanel);/*from w ww. ja v a2 s . co m*/ createLogViewPanel(); createGraghPanel(); JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, logViewPanel, chartPanel); splitPane.setResizeWeight(0.5); splitPane.setOneTouchExpandable(true); splitPane.setContinuousLayout(true); splitPane.setDividerLocation(150); dataPanel.add(splitPane); }
From source file:edu.ucla.stat.SOCR.chart.demo.SOCR_EM_MixtureModelChartDemo.java
protected void setTablePane() { dataPanel.removeAll();//from ww w . j a v a2 s . c o m JScrollPane st = new JScrollPane(layoutResults()); JScrollPane dt = new JScrollPane(dataTable); dt.setRowHeaderView(headerTable); JSplitPane container = new JSplitPane(JSplitPane.VERTICAL_SPLIT, dt, st); container.setContinuousLayout(true); container.setDividerLocation(0.8); dataPanel.add(container); dataPanel.validate(); }
From source file:com.codeasylum.stress.ui.Jormungandr.java
private synchronized Jormungandr init() throws IOException, SAXException, ParserConfigurationException { TestPlan testPlan;//from w ww . ja va2 s .c o m GhostPanel ghostPanel; GroupLayout groupLayout; ViewPanel viewPanel; JTree testTree; JSplitPane workSplitPane; JScrollPane paletteScrollPane; JScrollPane testScrollPane; setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); exchangeTransport = new ExchangeTransportImpl(exchangeTransportRMIPort); menuHandler = new JormungandrMenuHandler(this, menuDelegateFactory); testExecutor = new TestExecutor(testPlan = new TestPlan(), exchangeTransport); testExecutor.addTestExecutorListener(this); testPlan.getRootTask().setName(palette.getAvatar(RootTask.class).getName()); setGlassPane(ghostPanel = new GhostPanel()); setLayout(groupLayout = new GroupLayout(getContentPane())); testTree = new JTree(); palettePanel = new PalettePanel(this, ghostPanel, palette); testPanel = new TestPanel(this, ghostPanel, palette, viewPanel = new ViewPanel(testTree), testTree); paletteScrollPane = new JScrollPane(palettePanel, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); testScrollPane = new JScrollPane(testPanel, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); workSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, testScrollPane, viewPanel); workSplitPane.setDoubleBuffered(true); workSplitPane.setContinuousLayout(true); workSplitPane.setResizeWeight(0.3); groupLayout.setAutoCreateContainerGaps(true); groupLayout.setHorizontalGroup(groupLayout.createSequentialGroup() .addComponent(paletteScrollPane, (int) palettePanel.getMinimumSize().getWidth() + 3, (int) palettePanel.getPreferredSize().getWidth() + 3, (int) palettePanel.getMaximumSize().getWidth() + 3) .addComponent(workSplitPane)); groupLayout.setVerticalGroup(groupLayout.createParallelGroup() .addComponent(paletteScrollPane, 0, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE) .addComponent(workSplitPane, 0, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE)); setSize(new Dimension(Math.max(800, ((int) getLayout().preferredLayoutSize(this).getWidth()) + 120), Math.min(600, ((int) getLayout().preferredLayoutSize(this).getHeight()) + 38))); setLocationByPlatform(true); addWindowListener(this); return this; }
From source file:edu.ucla.stat.SOCR.chart.demo.SOCR_EM_MixtureModelChartDemo.java
protected void setMixPanel() { dataPanel2.removeAll();/*from w w w. j a v a2s .co m*/ graphPanel2.removeAll(); if (chartPaneltest != null) { chartPaneltest.setPreferredSize(new Dimension(CHART_SIZE_X * 2 / 3, CHART_SIZE_Y * 2 / 3)); graphPanel2.add(chartPaneltest); graphPanel2.validate(); } dataPanel2.setPreferredSize(new Dimension(CHART_SIZE_X * 2 / 3, CHART_SIZE_Y)); dataPanel2.add(new JLabel(" ")); dataPanel2.add(new JLabel("Data")); JScrollPane st = new JScrollPane(layoutResults()); JScrollPane dt = new JScrollPane(dataTable); dt.setRowHeaderView(headerTable); //dt.setPreferredSize(new Dimension(CHART_SIZE_X*2/3, CHART_SIZE_Y/2)); JSplitPane container = new JSplitPane(JSplitPane.VERTICAL_SPLIT, dt, st); container.setMinimumSize(new Dimension(CHART_SIZE_X * 2 / 3, CHART_SIZE_Y / 2)); container.setContinuousLayout(true); container.setDividerLocation(0.7); dataPanel2.add(container); dataPanel2.add(new JLabel(" ")); dataPanel2.add(new JLabel("Mapping")); mapPanel.setPreferredSize(new Dimension(CHART_SIZE_X * 2 / 3, CHART_SIZE_Y / 2)); dataPanel2.add(mapPanel); dataPanel2.validate(); mixPanel.removeAll(); mixPanel.add(graphPanel2, BorderLayout.WEST); mixPanel.add(dataPanel2, BorderLayout.CENTER); mixPanel.validate(); }
From source file:net.rptools.maptool.client.ui.MapToolFrame.java
private JComponent createDrawTreePanel() { final JTree tree = new JTree(); drawablesPanel = new DrawablesPanel(); drawPanelTreeModel = new DrawPanelTreeModel(tree); tree.setModel(drawPanelTreeModel);/*from w w w .j a v a 2s. c om*/ tree.setCellRenderer(new DrawPanelTreeCellRenderer()); tree.getSelectionModel().setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION); JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT); splitPane.setContinuousLayout(true); splitPane.setTopComponent(new JScrollPane(tree)); splitPane.setBottomComponent(drawablesPanel); splitPane.setDividerLocation(100); // Add mouse Event for right click menu tree.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { TreePath path = tree.getPathForLocation(e.getX(), e.getY()); if (path == null) { return; } Object row = path.getLastPathComponent(); int rowIndex = tree.getRowForLocation(e.getX(), e.getY()); if (SwingUtilities.isLeftMouseButton(e)) { if (!SwingUtil.isShiftDown(e) && !SwingUtil.isControlDown(e)) { tree.clearSelection(); } tree.addSelectionInterval(rowIndex, rowIndex); if (row instanceof DrawnElement) { if (e.getClickCount() == 2) { DrawnElement de = (DrawnElement) row; getCurrentZoneRenderer() .centerOn(new ZonePoint((int) de.getDrawable().getBounds().getCenterX(), (int) de.getDrawable().getBounds().getCenterY())); } } int[] treeRows = tree.getSelectionRows(); java.util.Arrays.sort(treeRows); drawablesPanel.clearSelectedIds(); for (int i = 0; i < treeRows.length; i++) { TreePath p = tree.getPathForRow(treeRows[i]); if (p.getLastPathComponent() instanceof DrawnElement) { DrawnElement de = (DrawnElement) p.getLastPathComponent(); drawablesPanel.addSelectedId(de.getDrawable().getId()); } } } if (SwingUtilities.isRightMouseButton(e)) { if (!isRowSelected(tree.getSelectionRows(), rowIndex) && !SwingUtil.isShiftDown(e)) { tree.clearSelection(); tree.addSelectionInterval(rowIndex, rowIndex); drawablesPanel.clearSelectedIds(); } final int x = e.getX(); final int y = e.getY(); EventQueue.invokeLater(new Runnable() { public void run() { DrawnElement firstElement = null; Set<GUID> selectedDrawSet = new HashSet<GUID>(); for (TreePath path : tree.getSelectionPaths()) { if (path.getLastPathComponent() instanceof DrawnElement) { DrawnElement de = (DrawnElement) path.getLastPathComponent(); if (firstElement == null) { firstElement = de; } selectedDrawSet.add(de.getDrawable().getId()); } } if (!selectedDrawSet.isEmpty()) { try { new DrawPanelPopupMenu(selectedDrawSet, x, y, getCurrentZoneRenderer(), firstElement).showPopup(tree); } catch (IllegalComponentStateException icse) { log.info(tree.toString(), icse); } } } }); } } }); // Add Zone Change event MapTool.getEventDispatcher().addListener(new AppEventListener() { public void handleAppEvent(AppEvent event) { drawPanelTreeModel.setZone((Zone) event.getNewValue()); } }, MapTool.ZoneEvent.Activated); return splitPane; }
From source file:edu.ucla.stat.SOCR.chart.Chart.java
/**This method initializes the Gui, by setting up the basic tabbedPanes.*/ public void init() { depMax = 1;/* w ww. j ava 2s . c o m*/ indMax = 1; chartTitle = this.getClass().getName(); chartTitle = chartTitle.substring(chartTitle.lastIndexOf(".") + 1); String fileName = "demo" + System.getProperty("file.separator") + chartTitle + ".html"; url = Chart.class.getResource(fileName); setName(chartTitle); //Get frame of the applet //frame = getFrame(this.getContentPane()); // Create the toolBar toolBar = new JToolBar(); createActionComponents(toolBar); this.getContentPane().add(toolBar, BorderLayout.NORTH); tabbedPanelContainer = new JTabbedPane(); dataObject = new Object[rowNumber][columnNumber]; columnNames = new String[columnNumber]; independentList = new ArrayList<Integer>(); dependentList = new ArrayList<Integer>(); for (int i = 0; i < columnNumber; i++) columnNames[i] = new String(DEFAULT_HEADER + (i + 1)); initTable(); initGraphPanel(); initMapPanel(); initMixPanel(); mixPanelContainer = new JScrollPane(mixPanel); mixPanelContainer.setPreferredSize(new Dimension(600, CHART_SIZE_Y + 100)); addTabbedPane(GRAPH, graphPanel); addTabbedPane(DATA, dataPanel); addTabbedPane(MAPPING, bPanel); addTabbedPane(ALL, mixPanelContainer); tabbedPanelContainer.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { if (tabbedPanelContainer.getTitleAt(tabbedPanelContainer.getSelectedIndex()) == ALL) { mixPanel.removeAll(); setMixPanel(); mixPanel.validate(); } else if (tabbedPanelContainer.getTitleAt(tabbedPanelContainer.getSelectedIndex()) == GRAPH) { graphPanel.removeAll(); //setGraphPanel(); //graphPanel.validate(); setChart(); } else if (tabbedPanelContainer.getTitleAt(tabbedPanelContainer.getSelectedIndex()) == DATA) { // setTablePane(); } else if (tabbedPanelContainer.getTitleAt(tabbedPanelContainer.getSelectedIndex()) == MAPPING) { bPanel.removeAll(); mapPanel.setPreferredSize(new Dimension(CHART_SIZE_X, CHART_SIZE_Y)); bPanel.add(mapPanel, BorderLayout.CENTER); bPanel.validate(); } } }); bPanel.addComponentListener(new ComponentListener() { public void componentResized(ComponentEvent e) { } public void componentMoved(ComponentEvent e) { } public void componentShown(ComponentEvent e) { // resultPanelTextArea.append("sucess"); // System.out.print("Success"); // Add code here for updating the Panel to show proper heading paintMappingLists(listIndex); } public void componentHidden(ComponentEvent e) { } }); // the right side (including top and bottom panels) statusTextArea = new JTextPane(); //right side lower statusTextArea.setEditable(false); JScrollPane statusContainer = new JScrollPane(statusTextArea); statusContainer.setPreferredSize(new Dimension(600, 140)); if (SHOW_STATUS_TEXTAREA) { JSplitPane container = new JSplitPane(JSplitPane.VERTICAL_SPLIT, new JScrollPane(tabbedPanelContainer), statusContainer); container.setContinuousLayout(true); container.setDividerLocation(0.6); this.getContentPane().add(container, BorderLayout.CENTER); } else { this.getContentPane().add(new JScrollPane(tabbedPanelContainer), BorderLayout.CENTER); } updateStatus(url); }
From source file:org.jets3t.apps.cockpit.Cockpit.java
/** * Initialises the application's GUI elements. */// w w w . j av 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); }