List of usage examples for javax.swing JScrollPane setHorizontalScrollBarPolicy
@BeanProperty(preferred = true, enumerationValues = { "ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED", "ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER", "ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS" }, description = "The scrollpane scrollbar policy") public void setHorizontalScrollBarPolicy(int policy)
From source file:ca.sqlpower.architect.swingui.ProfileGraphPanel.java
public ProfileGraphPanel(ProfilePanel panel, int rowCount) { this.profilePanel = panel; this.rowCount = rowCount; FormLayout displayLayout = new FormLayout("4dlu, default, 4dlu, 100dlu, 4dlu, fill:default:grow, 4dlu", // columns "4dlu, default, 6dlu"); // rows CellConstraints cc = new CellConstraints(); validResultsPanel = ProfileGraphPanel.logger.isDebugEnabled() ? new FormDebugPanel(displayLayout) : new JPanel(displayLayout); validResultsPanel.setBorder(BorderFactory.createEtchedBorder()); Font bodyFont = validResultsPanel.getFont(); Font titleFont = bodyFont.deriveFont(Font.BOLD, bodyFont.getSize() * 1.25F); title = new JLabel("Column Name"); title.setFont(titleFont);/*w w w . ja v a 2s. com*/ PanelBuilder pb = new PanelBuilder(displayLayout, validResultsPanel); pb.add(title, cc.xyw(2, 2, 5)); int row = 4; rowCountDisplay = makeInfoRow(pb, "RowCount", row); row += 2; nullableLabel = makeInfoRow(pb, "Nullable", row); row += 2; nullCountLabel = makeInfoRow(pb, "Null Count", row); row += 2; nullPercentLabel = makeInfoRow(pb, "% Null Records", row); row += 2; minLengthLabel = makeInfoRow(pb, "Minimum Length", row); row += 2; maxLengthLabel = makeInfoRow(pb, "Maximum Length", row); row += 2; uniqueCountLabel = makeInfoRow(pb, "Unique Values", row); row += 2; uniquePercentLabel = makeInfoRow(pb, "% Unique", row); row += 2; minValue = makeInfoRow(pb, "Minimum Value", row); row += 2; maxValue = makeInfoRow(pb, "Maximum Value", row); row += 2; avgValue = makeInfoRow(pb, "Average Value", row); row += 2; freqValueTable = new FreqValueTable(null); freqValueSp = new JScrollPane(freqValueTable); pb.appendRow("fill:10dlu:grow"); pb.appendRow("fill:default:grow"); pb.add(freqValueSp, cc.xyw(2, row + 1, 3)); // Now add something to represent the chart JFreeChart createPieChart = ChartFactory.createPieChart("", new DefaultPieDataset(new DefaultKeyedValues()), false, false, false); chartPanel = new ChartPanel(createPieChart); chartPanel.setPreferredSize(new Dimension(300, 300)); if (panel.getProfileManager().getWorkspaceContainer() instanceof ArchitectSession && ((ArchitectSession) panel.getProfileManager().getWorkspaceContainer()).isEnterpriseSession()) { pb.add(new JLabel("Column Profile Notes"), cc.xy(6, 2)); notesField = new JTextArea(); notesField.setLineWrap(true); notesField.setWrapStyleWord(true); JScrollPane notesScroll = new JScrollPane(notesField); notesScroll.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); notesScroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); pb.add(notesScroll, cc.xywh(6, 4, 1, row - 4)); pb.appendRow("fill:4dlu:grow"); pb.appendRow("4dlu"); pb.add(chartPanel, cc.xy(6, row + 1)); } else { pb.appendRow("fill:4dlu:grow"); pb.appendRow("4dlu"); pb.add(chartPanel, cc.xywh(6, 4, 1, row - 2)); } invalidResultsPanel = new JPanel(new BorderLayout()); invalidResultsLabel = new JLabel("No error message yet"); invalidResultsPanel.add(invalidResultsLabel); displayArea = new JPanel(new GridLayout(1, 1)); displayArea.setPreferredSize(validResultsPanel.getPreferredSize()); }
From source file:dk.dma.epd.common.prototype.gui.voct.VOCTAdditionalInfoPanel.java
/** * Constructor/*from w w w .ja v a 2s .c o m*/ * * @param compactLayout * if false, there will be message type selectors in the panel */ public VOCTAdditionalInfoPanel(boolean compactLayout) { super(new BorderLayout()); EPD.getInstance().getVoctHandler().addVoctSarInfoListener(this); // Prepare the title header titleHeader.setBackground(getBackground().darker()); titleHeader.setOpaque(true); titleHeader.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); titleHeader.setHorizontalAlignment(SwingConstants.CENTER); add(titleHeader, BorderLayout.NORTH); // Add messages panel scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); messagesPanel.setBackground(UIManager.getColor("List.background")); messagesPanel.setOpaque(false); messagesPanel.setLayout(new GridBagLayout()); messagesPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); add(scrollPane, BorderLayout.CENTER); JPanel sendPanel = new JPanel(new GridBagLayout()); add(sendPanel, BorderLayout.SOUTH); Insets insets = new Insets(2, 2, 2, 2); // Add text area // if (false) { // messageText = new JTextField(); // ((JTextField) messageText).addActionListener(this); // sendPanel.add(messageText, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, NORTH, BOTH, insets, 0, 0)); // // } else { messageText = new JTextArea(); JScrollPane scrollPane2 = new JScrollPane(messageText); scrollPane2.setPreferredSize(new Dimension(100, 50)); scrollPane2.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); scrollPane2.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); sendPanel.add(scrollPane2, new GridBagConstraints(0, 0, 1, 2, 1.0, 1.0, NORTH, BOTH, insets, 0, 0)); // } // Add buttons // ButtonGroup group = new ButtonGroup(); if (!compactLayout) { JToolBar msgTypePanel = new JToolBar(); msgTypePanel.setBorderPainted(false); msgTypePanel.setOpaque(true); msgTypePanel.setFloatable(false); sendPanel.add(msgTypePanel, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, NORTH, NONE, insets, 0, 0)); } if (compactLayout) { addBtn = new JButton("Add to Log"); sendPanel.add(addBtn, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, NORTH, NONE, insets, 0, 0)); } // addBtn.setEnabled(false); // messageText.setEditable(false); addBtn.addActionListener(this); }
From source file:com.emental.mindraider.ui.outline.OutlineArchiveJPanel.java
public OutlineArchiveJPanel() { setLayout(new BorderLayout()); // table with archived concepts (title) // let table model to load discarded concepts itself tableModel = new ArchiveTableModel(this); table = new JTable(tableModel); table.setAutoCreateRowSorter(true);/*from w w w . j ava 2 s . c o m*/ JScrollPane scroll = new JScrollPane(table); table.setFillsViewportHeight(true); table.setShowHorizontalLines(false); table.setShowVerticalLines(false); table.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION); scroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); scroll.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); JToolBar toolbar = new JToolBar(); undoButton = new JButton("", IconsRegistry.getImageIcon("trashUndo.png")); undoButton.setEnabled(false); undoButton.setToolTipText("Restore Note"); undoButton.addActionListener(new UndiscardConceptActionListener(tableModel, table)); toolbar.add(undoButton); deleteButton = new JButton("", IconsRegistry.getImageIcon("explorerDeleteSmall.png")); deleteButton.setEnabled(true); deleteButton.setToolTipText("Delete Note"); deleteButton.addActionListener(new DeleteConceptActionListener(tableModel, table)); toolbar.add(deleteButton); purgeButton = new JButton("", IconsRegistry.getImageIcon("trashFull.png")); purgeButton.setEnabled(true); purgeButton.setToolTipText("Empty Notes Archive"); purgeButton.addActionListener(new EmptyArchiveActionListener()); toolbar.add(purgeButton); add(toolbar, BorderLayout.NORTH); add(scroll, BorderLayout.CENTER); }
From source file:lu.lippmann.cdb.ext.hydviga.ui.GapsOverviewPanel.java
public void refresh(final Instances dataSet, final int dateIdx) { final Instances gapsDescriptionsDataset = GapsUtil.buildGapsDescription(gcp, dataSet, dateIdx); final JXTable gapsDescriptionsTable = new JXTable(); final InstanceTableModel gapsDescriptionsTableModel = new InstanceTableModel(false); gapsDescriptionsTableModel.setDataset(gapsDescriptionsDataset); gapsDescriptionsTable.setModel(gapsDescriptionsTableModel); gapsDescriptionsTable.setEditable(true); gapsDescriptionsTable.setShowHorizontalLines(false); gapsDescriptionsTable.setShowVerticalLines(false); gapsDescriptionsTable.setVisibleRowCount(5); gapsDescriptionsTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); gapsDescriptionsTable.setSortable(false); gapsDescriptionsTable.packAll();/* w ww .j a v a 2s . co m*/ gapsDescriptionsTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); gapsDescriptionsTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { int modelRow = gapsDescriptionsTable.getSelectedRow(); if (modelRow < 0) modelRow = 0; final String attrname = gapsDescriptionsTableModel.getValueAt(modelRow, 1).toString(); final Attribute attr = dataSet.attribute(attrname); final int gapsize = (int) Double .valueOf(gapsDescriptionsTableModel.getValueAt(modelRow, 5).toString()).doubleValue(); final int position = (int) Double .valueOf(gapsDescriptionsTableModel.getValueAt(modelRow, 6).toString()).doubleValue(); try { final ChartPanel cp = GapsUIUtil.buildGapChartPanel(dataSet, dateIdx, attr, gapsize, position); visualOverviewPanel.removeAll(); visualOverviewPanel.add(cp, BorderLayout.CENTER); geomapPanel.removeAll(); geomapPanel.add(gcp.getMapPanel(Arrays.asList(attrname), new ArrayList<String>(), false)); jxp.updateUI(); } catch (Exception ee) { ee.printStackTrace(); } } } }); gapsDescriptionsTable.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(final MouseEvent e) { final InstanceTableModel instanceTableModel = (InstanceTableModel) gapsDescriptionsTable.getModel(); final int row = gapsDescriptionsTable.rowAtPoint(e.getPoint()); //final int row=gapsDescriptionsTable.getSelectedRow(); final int modelRow = gapsDescriptionsTable.convertRowIndexToModel(row); //final int modelRow=(int)Double.valueOf(instanceTableModel.getValueAt(row,0).toString()).doubleValue(); //System.out.println(row+" "+modelRow); final String attrname = instanceTableModel.getValueAt(modelRow, 1).toString(); final Attribute attr = dataSet.attribute(attrname); final int gapsize = (int) Double.valueOf(instanceTableModel.getValueAt(modelRow, 5).toString()) .doubleValue(); final int position = (int) Double.valueOf(instanceTableModel.getValueAt(modelRow, 6).toString()) .doubleValue(); if (!e.isPopupTrigger()) { // nothing? } else { final JPopupMenu jPopupMenu = new JPopupMenu("feur"); final JMenuItem interactiveFillMenuItem = new JMenuItem("Fill this gap (interactively)"); interactiveFillMenuItem.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { final GapFillingFrame jxf = new GapFillingFrame(atv, dataSet, attr, dateIdx, GapsUtil.getCountOfValuesBeforeAndAfter(gapsize), position, gapsize, gcp, false); jxf.setSize(new Dimension(900, 700)); //jxf.setExtendedState(Frame.MAXIMIZED_BOTH); jxf.setLocationRelativeTo(jPopupMenu); jxf.setVisible(true); //jxf.setResizable(false); } }); jPopupMenu.add(interactiveFillMenuItem); final JMenuItem lookupInKnowledgeDBMenuItem = new JMenuItem( "Show the most similar cases from KnowledgeDB"); lookupInKnowledgeDBMenuItem.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { final double x = gcp.getCoordinates(attrname)[0]; final double y = gcp.getCoordinates(attrname)[1]; final String season = instanceTableModel.getValueAt(modelRow, 3).toString() .split("/")[0]; final boolean isDuringRising = instanceTableModel.getValueAt(modelRow, 11).toString() .equals("true"); try { final Calendar cal = Calendar.getInstance(); final String dateAsString = instanceTableModel.getValueAt(modelRow, 2).toString() .replaceAll("'", ""); cal.setTime(FormatterUtil.DATE_FORMAT.parse(dateAsString)); final int year = cal.get(Calendar.YEAR); new SimilarCasesFrame(dataSet, dateIdx, gcp, attrname, gapsize, position, x, y, year, season, isDuringRising); } catch (Exception e1) { e1.printStackTrace(); } } }); jPopupMenu.add(lookupInKnowledgeDBMenuItem); final JMenuItem mExport = new JMenuItem("Export this table as CSV"); mExport.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { final JFileChooser fc = new JFileChooser(); fc.setAcceptAllFileFilterUsed(false); final int returnVal = fc.showSaveDialog(gapsDescriptionsTable); if (returnVal == JFileChooser.APPROVE_OPTION) { try { final File file = fc.getSelectedFile(); WekaDataAccessUtil.saveInstancesIntoCSVFile(gapsDescriptionsDataset, file); } catch (Exception ee) { ee.printStackTrace(); } } } }); jPopupMenu.add(mExport); jPopupMenu.show(gapsDescriptionsTable, e.getX(), e.getY()); } } }); final int tableWidth = (int) gapsDescriptionsTable.getPreferredSize().getWidth() + 30; final JScrollPane scrollPane = new JScrollPane(gapsDescriptionsTable); scrollPane.setPreferredSize(new Dimension(Math.min(tableWidth, 500), 500)); scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); this.tablePanel.removeAll(); this.tablePanel.add(scrollPane, BorderLayout.CENTER); this.visualOverviewPanel.removeAll(); /* automatically compute the most similar series and the 'rising' flag */ new AbstractSimpleAsync<Void>(false) { @Override public Void execute() throws Exception { final int rc = gapsDescriptionsTableModel.getRowCount(); for (int i = 0; i < rc; i++) { final int modelRow = i; try { final String attrname = gapsDescriptionsTableModel.getValueAt(modelRow, 1).toString(); final Attribute attr = dataSet.attribute(attrname); final int gapsize = (int) Double .valueOf(gapsDescriptionsTableModel.getValueAt(modelRow, 5).toString()) .doubleValue(); final int position = (int) Double .valueOf(gapsDescriptionsTableModel.getValueAt(modelRow, 6).toString()) .doubleValue(); /* most similar */ gapsDescriptionsTableModel.setValueAt("...", modelRow, 7); final int cvba = GapsUtil.getCountOfValuesBeforeAndAfter(gapsize); Instances gapds = WekaDataProcessingUtil.buildFilteredDataSet(dataSet, 0, dataSet.numAttributes() - 1, Math.max(0, position - cvba), Math.min(position + gapsize + cvba, dataSet.numInstances() - 1)); final String mostsimilar = WekaTimeSeriesSimilarityUtil.findMostSimilarTimeSerie(gapds, attr, WekaTimeSeriesUtil.getNamesOfAttributesWithoutGap(gapds), false); gapsDescriptionsTableModel.setValueAt(mostsimilar, modelRow, 7); /* 'rising' flag */ gapsDescriptionsTableModel.setValueAt("...", modelRow, 11); final List<String> attributeNames = WekaDataStatsUtil.getAttributeNames(dataSet); attributeNames.remove("timestamp"); final String nearestStationName = gcp.findNearestStation(attr.name(), attributeNames); final Attribute nearestStationAttr = dataSet.attribute(nearestStationName); //System.out.println(nearestStationName+" "+nearestStationAttr); final boolean isDuringRising = GapsUtil.isDuringRising(dataSet, position, gapsize, new int[] { dateIdx, attr.index(), nearestStationAttr.index() }); gapsDescriptionsTableModel.setValueAt(isDuringRising, modelRow, 11); gapsDescriptionsTableModel.fireTableDataChanged(); } catch (Exception e) { gapsDescriptionsTableModel.setValueAt("n/a", modelRow, 7); gapsDescriptionsTableModel.setValueAt("n/a", modelRow, 11); e.printStackTrace(); } } return null; } @Override public void onSuccess(Void result) { } @Override public void onFailure(Throwable caught) { caught.printStackTrace(); } }.start(); /* select the first row */ gapsDescriptionsTable.setRowSelectionInterval(0, 0); }
From source file:dk.dma.epd.common.prototype.gui.notification.ChatServicePanel.java
/** * Constructor//ww w . j a v a 2 s . co m * * @param compactLayout * if false, there will be message type selectors in the panel */ public ChatServicePanel(boolean compactLayout) { super(new BorderLayout()); // Prepare the title header titleHeader.setBackground(getBackground().darker()); titleHeader.setOpaque(true); titleHeader.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); titleHeader.setHorizontalAlignment(SwingConstants.CENTER); add(titleHeader, BorderLayout.NORTH); // Add messages panel scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); messagesPanel.setBackground(UIManager.getColor("List.background")); messagesPanel.setOpaque(false); messagesPanel.setLayout(new GridBagLayout()); messagesPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); add(scrollPane, BorderLayout.CENTER); JPanel sendPanel = new JPanel(new GridBagLayout()); add(sendPanel, BorderLayout.SOUTH); Insets insets = new Insets(2, 2, 2, 2); // Add text area if (compactLayout) { messageText = new JTextField(); ((JTextField) messageText).addActionListener(this); sendPanel.add(messageText, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, NORTH, BOTH, insets, 0, 0)); } else { messageText = new JTextArea(); JScrollPane scrollPane2 = new JScrollPane(messageText); scrollPane2.setPreferredSize(new Dimension(100, 50)); scrollPane2.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); scrollPane2.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); sendPanel.add(scrollPane2, new GridBagConstraints(0, 0, 1, 2, 1.0, 1.0, NORTH, BOTH, insets, 0, 0)); } // Add buttons ButtonGroup group = new ButtonGroup(); messageTypeBtn = createMessageTypeButton("Send messages", ICON_MESSAGE, true, group); warningTypeBtn = createMessageTypeButton("Send warnings", ICON_WARNING, false, group); alertTypeBtn = createMessageTypeButton("Send alerts", ICON_ALERT, false, group); if (!compactLayout) { JToolBar msgTypePanel = new JToolBar(); msgTypePanel.setBorderPainted(false); msgTypePanel.setOpaque(true); msgTypePanel.setFloatable(false); sendPanel.add(msgTypePanel, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, NORTH, NONE, insets, 0, 0)); msgTypePanel.add(messageTypeBtn); msgTypePanel.add(warningTypeBtn); msgTypePanel.add(alertTypeBtn); } if (compactLayout) { sendBtn = new JButton("Send"); sendPanel.add(sendBtn, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, NORTH, NONE, insets, 0, 0)); } else { sendBtn = new JButton("Send", ICON_MESSAGE); sendBtn.setPreferredSize(new Dimension(100, sendBtn.getPreferredSize().height)); sendPanel.add(sendBtn, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, NORTH, NONE, insets, 0, 0)); } sendBtn.setEnabled(false); messageText.setEditable(false); sendBtn.addActionListener(this); }
From source file:edu.ku.brc.af.core.NavBox.java
/** * Constructor (with name)./*from w w w.jav a 2 s . c o m*/ * @param name the name of the NavBox. * @param collapsable indicates whether the NavBox can be collapsable */ public NavBox(final String name, final boolean collapsable, final boolean scrollable) { super(); this.name = name; setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); this.scrollable = scrollable; SkinItem skinItem = SkinsMgr.getSkinItem("NavBox"); if (scrollable) { itemsPanel = new JPanel();//new BoxLayout(this, BoxLayout.Y_AXIS)); itemsPanel.setBorder(null); if (skinItem != null) { itemsPanel.setOpaque(skinItem.isOpaque()); skinItem.setupPanel(itemsPanel); } else { itemsPanel.setBackground(NavBoxMgr.getBGColor()); } } setBorder(BorderFactory.createEmptyBorder(22, 4, 4, 4)); setBackground(NavBoxMgr.getBGColor()); setOpaque(!SkinsMgr.hasSkins()); if (scrollable) { JScrollPane scrollPane = new JScrollPane(itemsPanel); scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); scrollPane.setBorder(null); add(scrollPane); } if (collapsable) { /* collapsableIconOpen = IconManager.getIcon("Minimize"); collapsableIconClosed = IconManager.getIcon("Maximize"); addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (iconRect != null && iconRect.contains(e.getPoint())) { collapsed = !collapsed; if (collapsed) { icon = collapsableIconClosed; setSize(getSize().width, minHeight); } else { icon = collapsableIconOpen; setSize(getPreferredSize()); } validate(); invalidate(); doLayout(); } } }); */ } }
From source file:com.rapidminer.gui.properties.OperatorPropertyPanel.java
@Override public Component getComponent() { if (dockableComponent == null) { JScrollPane scrollPane = new ExtendedJScrollPane(this); scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); scrollPane.setBorder(null);// w w w . j a v a 2 s .c o m dockableComponent = new JPanel(new BorderLayout()); JPanel toolBarPanel = new JPanel(new BorderLayout()); ViewToolBar toolBar = new ViewToolBar(); JToggleButton toggleExpertModeButton = mainFrame.TOGGLE_EXPERT_MODE_ACTION.createToggleButton(); toggleExpertModeButton.setText(null); toolBar.add(toggleExpertModeButton); showHelpAction.setSelected(isShowParameterHelp()); JToggleButton helpToggleButton = showHelpAction.createToggleButton(); helpToggleButton.setText(null); toolBar.add(helpToggleButton); Action infoOperatorAction = new InfoOperatorAction() { private static final long serialVersionUID = 6758272768665592429L; @Override protected Operator getOperator() { return mainFrame.getFirstSelectedOperator(); } }; toolBar.add(infoOperatorAction); JToggleButton enableOperatorButton = new ToggleActivationItem(mainFrame.getActions()) .createToggleButton(); enableOperatorButton.setText(null); toolBar.add(enableOperatorButton); Action renameOperatorAction = new ResourceAction(true, "rename_in_processrenderer") { { setCondition(OPERATOR_SELECTED, MANDATORY); } private static final long serialVersionUID = -3104160320178045540L; @Override public void actionPerformed(ActionEvent e) { Operator operator = mainFrame.getFirstSelectedOperator(); String name = SwingTools.showInputDialog("rename_operator", operator.getName()); if (name != null && name.length() > 0) { operator.rename(name); } } }; toolBar.add(renameOperatorAction); toolBar.add(new DeleteOperatorAction()); breakpointButton.addToToolBar(toolBar); // toolBar.add(mainFrame.getActions().MAKE_DIRTY_ACTION); toolBarPanel.add(toolBar, BorderLayout.NORTH); JPanel headerPanel = new JPanel(); headerPanel.setBackground(SwingTools.LIGHTEST_BLUE); headerPanel.add(headerLabel); headerPanel.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.LIGHT_GRAY)); toolBarPanel.add(headerPanel, BorderLayout.SOUTH); dockableComponent.add(toolBarPanel, BorderLayout.NORTH); dockableComponent.add(scrollPane, BorderLayout.CENTER); // compatibility level and warnings JPanel southPanel = new JPanel(new BorderLayout()); southPanel.add(expertModeHintLabel, BorderLayout.CENTER); compatibilityLabel.setLabelFor(compatibilityLevelSpinner); compatibilityLevelSpinner.setPreferredSize( new Dimension(80, (int) compatibilityLevelSpinner.getPreferredSize().getHeight())); compatibilityPanel.add(compatibilityLabel); compatibilityPanel.add(compatibilityLevelSpinner); southPanel.add(compatibilityPanel, BorderLayout.SOUTH); dockableComponent.add(southPanel, BorderLayout.SOUTH); } return dockableComponent; }
From source file:ac.openmicrolabs.view.gui.OMLLoggerView.java
private JPanel createContentPane(final TimeSeriesCollection t, final String graphTitle, final double graphTimeRange, final String[] signals) { btmPanel.remove(reportButton);// w w w. j a v a2 s. c om chanLabel = new JLabel[signals.length]; int activeSignalCount = 0; for (int i = 0; i < signals.length; i++) { chanLabel[i] = new JLabel(h.format("label", (char) ((i / PIN_COUNT) + ASCII_OFFSET) + "-0x" + String.format("%02x", (i % PIN_COUNT) + SLAVE_BITS).toUpperCase())); chanLabel[i].setHorizontalAlignment(JLabel.CENTER); if (signals[i] != null) { activeSignalCount++; } else { chanLabel[i].setEnabled(false); } } typeLabel = new JLabel[activeSignalCount]; valLabel = new JLabel[activeSignalCount]; minLabel = new JLabel[activeSignalCount]; maxLabel = new JLabel[activeSignalCount]; avgLabel = new JLabel[activeSignalCount]; int index = 0; for (int i = 0; i < signals.length; i++) { if (signals[i] != null) { typeLabel[index] = new JLabel(h.format("body", signals[i])); typeLabel[index].setHorizontalAlignment(JLabel.CENTER); index++; } } for (int i = 0; i < activeSignalCount; i++) { valLabel[i] = new JLabel(); valLabel[i].setHorizontalAlignment(JLabel.CENTER); minLabel[i] = new JLabel(); minLabel[i].setHorizontalAlignment(JLabel.CENTER); maxLabel[i] = new JLabel(); maxLabel[i].setHorizontalAlignment(JLabel.CENTER); avgLabel[i] = new JLabel(); avgLabel[i].setHorizontalAlignment(JLabel.CENTER); } // Set up main panel. JPanel mainPanel = new JPanel(); mainPanel.setLayout(null); mainPanel.setBackground(Color.white); // Create graph. snsChart = ChartFactory.createTimeSeriesChart(graphTitle, GRAPH_X_LABEL, GRAPH_Y_LABEL, t, true, true, false); final XYPlot plot = snsChart.getXYPlot(); ValueAxis axis = plot.getDomainAxis(); axis.setAutoRange(true); axis.setFixedAutoRange(graphTimeRange); axis = plot.getRangeAxis(); axis.setRange(graphMinY, graphMaxY); ChartPanel snsChartPanel = new ChartPanel(snsChart); snsChartPanel.setPreferredSize(new Dimension(FRAME_WIDTH - PAD20, GRAPH_HEIGHT - PAD10)); // Set up graph panel. final JPanel graphPanel = new JPanel(); graphPanel.setSize(FRAME_WIDTH - PAD20, GRAPH_HEIGHT); graphPanel.setLocation(0, 0); graphPanel.setBackground(Color.white); graphPanel.add(snsChartPanel); // Set up results panel. final JPanel resultsPanel = createResultsPane(); // Set up scroll pane. final JScrollPane scrollPane = new JScrollPane(resultsPanel); scrollPane.setSize(FRAME_WIDTH - PAD20, FRAME_HEIGHT - BTM_HEIGHT - GRAPH_HEIGHT + PAD8); scrollPane.setLocation(PAD5, GRAPH_HEIGHT); scrollPane.setBackground(Color.white); scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER); // Set results panel size. resultsPanel.setPreferredSize(new Dimension(PAD40 + (signals.length * RESULTS_COL_WIDTH), FRAME_HEIGHT - BTM_HEIGHT - GRAPH_HEIGHT - PAD120)); resultsPanel.revalidate(); // Set up bottom panel. btmPanel.setLayout(null); btmPanel.setSize(FRAME_WIDTH, BTM_HEIGHT); btmPanel.setLocation(0, this.getHeight() - BTM_HEIGHT); btmPanel.setBackground(Color.white); // Instantiate bottom panel objects. footerLabel.setSize(LABEL_WIDTH, LABEL_HEIGHT); footerLabel.setLocation(LABEL_X, LABEL_Y); footerLabel.setText(""); doneButton.setIcon(new ImageIcon("img/22x22/stop.png")); doneButton.setSize(DONE_WIDTH, DONE_HEIGHT); doneButton.setLocation(FRAME_WIDTH - PAD20 - doneButton.getWidth(), PAD15); progressBar = new JProgressBar(); progressBar.setSize(FRAME_WIDTH - PAD40 - doneButton.getWidth() - footerLabel.getWidth(), PAD20); progressBar.setValue(0); progressBar.setLocation(footerLabel.getWidth() + PAD10, PAD22); // Populate bottom panel. btmPanel.add(footerLabel); btmPanel.add(progressBar); btmPanel.add(doneButton); // Populate main panel. mainPanel.add(graphPanel); mainPanel.add(scrollPane); mainPanel.add(btmPanel); return mainPanel; }
From source file:com.vgi.mafscaling.Rescale.java
private void createMafScalesScrollPane(JPanel dataPanel) { JPanel mafPanel = new JPanel(); GridBagLayout gbl_mafPanelLayout = new GridBagLayout(); gbl_mafPanelLayout.columnWidths = new int[] { 0 }; gbl_mafPanelLayout.rowHeights = new int[] { 0, 0 }; gbl_mafPanelLayout.columnWeights = new double[] { 0.0, 1.0 }; gbl_mafPanelLayout.rowWeights = new double[] { 0.0, 1.0 }; mafPanel.setLayout(gbl_mafPanelLayout); JScrollPane mafScrollPane = new JScrollPane(mafPanel); mafScrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER); mafScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); GridBagConstraints gbl_mafScrollPane = new GridBagConstraints(); gbl_mafScrollPane.anchor = GridBagConstraints.PAGE_START; gbl_mafScrollPane.fill = GridBagConstraints.HORIZONTAL; gbl_mafScrollPane.insets = insets0;//from w w w . j av a 2 s.co m gbl_mafScrollPane.weightx = 1.0; gbl_mafScrollPane.gridx = 0; gbl_mafScrollPane.gridy = 1; gbl_mafScrollPane.ipady = 120; dataPanel.add(mafScrollPane, gbl_mafScrollPane); GridBagConstraints gbc_mafScrollPane = new GridBagConstraints(); gbc_mafScrollPane.anchor = GridBagConstraints.PAGE_START; gbc_mafScrollPane.weightx = 1.0; gbc_mafScrollPane.weighty = 1.0; gbc_mafScrollPane.insets = insets0; gbc_mafScrollPane.fill = GridBagConstraints.HORIZONTAL; gbc_mafScrollPane.gridx = 0; gbc_mafScrollPane.gridy = 0; MafTablePane origMafScrollPane = new MafTablePane(ColumnWidth, OrigMafTableName, false, false); origMafScrollPane.setBorder(null); origMafScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); origMafTable = origMafScrollPane.getJTable(); excelAdapter.addTable(origMafTable, false, false, false, false, false, false, false, false, true); mafPanel.add(origMafScrollPane, gbc_mafScrollPane); MafTablePane newMafScrollPane = new MafTablePane(ColumnWidth, NewMafTableName, false, true); newMafScrollPane.setBorder(null); newMafScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); newMafTable = newMafScrollPane.getJTable(); newMafExcelAdapter.addTable(newMafTable, false, false, false, false, false, false, false, false, true); gbc_mafScrollPane.gridy++; mafPanel.add(newMafScrollPane, gbc_mafScrollPane); Action action = new AbstractAction() { private static final long serialVersionUID = 1L; public void actionPerformed(ActionEvent e) { recalculateNewGs(); } }; setNewMafTableCellListenerListener(new TableCellListener(newMafTable, action)); }
From source file:lol.search.RankedStatsPage.java
private JScrollPane championSelectPanel() { JPanel mainPanel = new JPanel(new FlowLayout()); //mainPanel.setBorder(BorderFactory.createLineBorder(Color.WHITE)); mainPanel.setBackground(backgroundColor); for (int i = 0; i < this.objChampRankedList.size(); i++) { int position = counter; ImageIcon champImageIcon = this.OBJ_RANKED_STATS_BY_ID.getChampionIconOf(this.champKeyList.get(i)); JButton champButton = new JButton(); champButton.setIcon(champImageIcon); if (i == 0) { champButton.setIcon(this.profileIcon); champButton.setToolTipText("Overall Stats"); }/* w w w . j av a 2 s. c o m*/ champButton.setPreferredSize(new Dimension(55, 55)); champButton.setBackground(Color.BLACK); champButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { //button pressed background.setIcon(OBJ_GAME_STATIC_DATA.getBackgroundImageIcon(champKeyList.get(position))); loadArtLabel.setIcon(OBJ_GAME_STATIC_DATA.initLoadingArt(champKeyList.get(position))); nameHeader.setText(OBJ_ALL_CHAMPS_BY_ID.getChampNameFromId(champIdList.get(position))); titleHeader.setText(" " + OBJ_ALL_CHAMPS_BY_ID.getChampTitleFromId(champIdList.get(position))); String sessionsWon = ""; String sessionsLost = ""; String winPercentString = ""; try { int won = objChampRankedList.get(position).getJSONObject("stats") .getInt("totalSessionsWon"); sessionsWon = Integer.toString(won); int lost = objChampRankedList.get(position).getJSONObject("stats") .getInt("totalSessionsLost"); sessionsLost = Integer.toString(lost); winPercentString = getWinPercentage(won, lost); totalGamesInt = won + lost; avgKillsLabelValue.setText(new DecimalFormat("##.##") .format((double) objChampRankedList.get(position).getJSONObject("stats") .getInt("totalChampionKills") / (double) totalGamesInt)); avgAssistsLabelValue .setText(new DecimalFormat("##.##").format((double) objChampRankedList.get(position) .getJSONObject("stats").getInt("totalAssists") / (double) totalGamesInt)); avgDeathsLabelValue.setText(new DecimalFormat("##.##") .format((double) objChampRankedList.get(position).getJSONObject("stats") .getInt("totalDeathsPerSession") / (double) totalGamesInt)); avgMinionKillsLabelValue.setText(new DecimalFormat("##.##") .format((double) objChampRankedList.get(position).getJSONObject("stats") .getInt("totalMinionKills") / (double) totalGamesInt)); avgDoubleKillsLabelValue.setText(new DecimalFormat("##.##") .format((double) objChampRankedList.get(position).getJSONObject("stats") .getInt("totalDoubleKills") / (double) totalGamesInt)); avgTripleKillsLabelValue.setText(new DecimalFormat("##.##") .format((double) objChampRankedList.get(position).getJSONObject("stats") .getInt("totalTripleKills") / (double) totalGamesInt)); avgQuadKillsLabelValue.setText(new DecimalFormat("##.##") .format((double) objChampRankedList.get(position).getJSONObject("stats") .getInt("totalQuadraKills") / (double) totalGamesInt)); avgPentaKillsLabelValue.setText(new DecimalFormat("##.##") .format((double) objChampRankedList.get(position).getJSONObject("stats") .getInt("totalPentaKills") / (double) totalGamesInt)); totalKillsLabelValue.setText(new DecimalFormat("#######").format((double) objChampRankedList .get(position).getJSONObject("stats").getInt("totalChampionKills"))); totalDeathsLabelValue .setText(new DecimalFormat("#######").format((double) objChampRankedList .get(position).getJSONObject("stats").getInt("totalDeathsPerSession"))); totalAssistsLabelValue .setText(new DecimalFormat("#######").format((double) objChampRankedList .get(position).getJSONObject("stats").getInt("totalAssists"))); totalMinionsLabelValue .setText(new DecimalFormat("#######").format((double) objChampRankedList .get(position).getJSONObject("stats").getInt("totalMinionKills"))); totalDoubleKillsLabelValue .setText(new DecimalFormat("#######").format((double) objChampRankedList .get(position).getJSONObject("stats").getInt("totalDoubleKills"))); totalTripleKillsLabelValue .setText(new DecimalFormat("#######").format((double) objChampRankedList .get(position).getJSONObject("stats").getInt("totalTripleKills"))); totalQuadKillsLabelValue .setText(new DecimalFormat("#######").format((double) objChampRankedList .get(position).getJSONObject("stats").getInt("totalQuadraKills"))); totalPentaKillsLabelValue .setText(new DecimalFormat("#######").format((double) objChampRankedList .get(position).getJSONObject("stats").getInt("totalPentaKills"))); } catch (JSONException ex) { Logger.getLogger(RankedStatsPage.class.getName()).log(Level.SEVERE, null, ex); } totalWins.setText(sessionsWon); totalLosses.setText(sessionsLost); winPercent.setText(winPercentString + "%"); totalGamesPlayed.setText(String.valueOf(totalGamesInt)); masterFrame.revalidate(); masterFrame.repaint(); } }); champButton.setToolTipText(OBJ_ALL_CHAMPS_BY_ID.getChampNameFromId(champIdList.get(position))); champButtons.add(champButton); //champButton.setBorder(BorderFactory.createLineBorder(Color.BLACK)); counter++; } for (int i = 0; i < champButtons.size(); i++) { mainPanel.add(champButtons.get(i)); mainPanel.revalidate(); } JScrollPane scrollPane = new JScrollPane(mainPanel); scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER); scrollPane.setPreferredSize(new Dimension(1200, 85)); scrollPane.setBackground(new Color(0, 0, 0, 100)); scrollPane.setBorder(BorderFactory.createLineBorder(Color.BLACK)); scrollPane.getHorizontalScrollBar().setUI(new BasicScrollBarUI() { @Override protected void configureScrollBarColors() { this.thumbColor = new Color(124, 124, 124, 255); this.trackColor = Color.BLACK; } }); return scrollPane; }