Java Code Examples for javax.swing.JScrollPane#setViewportView()
The following examples show how to use
javax.swing.JScrollPane#setViewportView() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LasInfoView.java From hortonmachine with GNU General Public License v3.0 | 6 votes |
public JPanel createPanel3() { JPanel jpanel1 = new JPanel(); TitledBorder titledborder1 = new TitledBorder(null,"Header Information",TitledBorder.DEFAULT_JUSTIFICATION,TitledBorder.DEFAULT_POSITION,null,new Color(33,33,33)); jpanel1.setBorder(titledborder1); FormLayout formlayout1 = new FormLayout("FILL:DEFAULT:GROW(1.0)","FILL:DEFAULT:GROW(1.0)"); CellConstraints cc = new CellConstraints(); jpanel1.setLayout(formlayout1); _headerTable.setName("headerTable"); JScrollPane jscrollpane1 = new JScrollPane(); jscrollpane1.setViewportView(_headerTable); jscrollpane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); jscrollpane1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); jpanel1.add(jscrollpane1,cc.xy(1,1)); addFillComponents(jpanel1,new int[0],new int[0]); return jpanel1; }
Example 2
Source File: LasInfoView.java From hortonmachine with GNU General Public License v3.0 | 6 votes |
public JPanel createPanel4() { JPanel jpanel1 = new JPanel(); TitledBorder titledborder1 = new TitledBorder(null,"First Point Information",TitledBorder.DEFAULT_JUSTIFICATION,TitledBorder.DEFAULT_POSITION,null,new Color(33,33,33)); jpanel1.setBorder(titledborder1); FormLayout formlayout1 = new FormLayout("FILL:DEFAULT:GROW(1.0)","FILL:DEFAULT:NONE"); CellConstraints cc = new CellConstraints(); jpanel1.setLayout(formlayout1); _firstPointTable.setName("firstPointTable"); JScrollPane jscrollpane1 = new JScrollPane(); jscrollpane1.setViewportView(_firstPointTable); jscrollpane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); jscrollpane1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); jpanel1.add(jscrollpane1,cc.xy(1,1)); addFillComponents(jpanel1,new int[0],new int[0]); return jpanel1; }
Example 3
Source File: SecurityAddGroupPanel.java From netbeans with Apache License 2.0 | 6 votes |
private void initUserComponents() { /* Save preferred size before adding table. We have our own width and * will add a constant of our own choosing for the height in init(), below. */ initialPreferredSize = getPreferredSize(); /** Add table after preferred size is saved. */ existingGroupsTable = new FixedHeightJTable(); existingGroupsTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); existingGroupsTable.getSelectionModel().addListSelectionListener(this); JScrollPane scrollPane = new JScrollPane(); scrollPane.setViewportView(existingGroupsTable); GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new Insets(2, 11, 11, 11); add(scrollPane, gridBagConstraints); getAccessibleContext().setAccessibleName(customizerBundle.getString("ACSN_AddGroupName")); // NOI18N getAccessibleContext().setAccessibleDescription(customizerBundle.getString("ACSD_AddGroupName")); // NOI18N }
Example 4
Source File: VendorOptionInfoPanel.java From sldeditor with GNU General Public License v3.0 | 5 votes |
/** Creates the UI. */ private void createUI() { setLayout(new BorderLayout()); JScrollPane scrollPane = new JScrollPane(); add(scrollPane, BorderLayout.CENTER); vendorOptionTable = new JTable(); scrollPane.setViewportView(vendorOptionTable); vendorOptionTable.setModel(model); vendorOptionTable .getColumnModel() .getColumn(0) .setCellRenderer(new VendorOptionInfoCellRenderer(model)); vendorOptionTable .getColumnModel() .getColumn(1) .setCellRenderer(new VendorOptionInfoCellRenderer(model)); vendorOptionTable .getSelectionModel() .addListSelectionListener( new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { displayDescription(vendorOptionTable.getSelectedRow()); } }); descriptionArea = new JTextArea(); descriptionArea.setEditable(false); descriptionArea.setRows(5); descriptionArea.setLineWrap(true); descriptionArea.setWrapStyleWord(true); descriptionArea.setFont(vendorOptionTable.getFont()); JScrollPane descriptionAreaScrollPane = new JScrollPane(descriptionArea); add(descriptionAreaScrollPane, BorderLayout.EAST); descriptionAreaScrollPane.setPreferredSize(new Dimension(200, 100)); }
Example 5
Source File: PainelSelecaoCor.java From brModelo with GNU General Public License v3.0 | 5 votes |
@Override public void buildChooser() { setLayout(new BorderLayout());// GridLayout(0, 1)); if (!itens.isEmpty()) { JScrollPane jsp = new javax.swing.JScrollPane(); lst = new JList(itens.toArray(new Legenda.ItemDeLegenda[]{})); add(jsp, BorderLayout.EAST); jsp.add(lst); jsp.setViewportView(lst); lst.setModel(new javax.swing.AbstractListModel() { @Override public int getSize() { return itens.size(); } @Override public Object getElementAt(int i) { return itens.get(i); } }); lst.addListSelectionListener( e -> { if (e == null || lst.getSelectedIndex() < 0) { return; } Legenda.ItemDeLegenda r = itens.get(lst.getSelectedIndex()); getColorSelectionModel().setSelectedColor(r.getCor()); }); lst.setCellRenderer(new JListItemParaItemLegenda(false)); } }
Example 6
Source File: ReportDefect.java From Cognizant-Intelligent-Test-Scripter with Apache License 2.0 | 5 votes |
/** * set up the editor control of the field * * @param jc * @return */ JComponent getUsableControl(JComponent jc) { if (jc instanceof JTextArea) { JScrollPane js = new JScrollPane(); js.setPreferredSize(new Dimension(200, 100)); js.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); js.setViewportView(jc); return js; } else { return jc; } }
Example 7
Source File: TextViewOOM.java From hottub with GNU General Public License v2.0 | 5 votes |
private static void createAndShowGUI() { frame = new JFrame(); final JScrollPane jScrollPane1 = new JScrollPane(); ta = new JTextArea(); ta.setEditable(false); ta.setColumns(20); ta.setRows(5); jScrollPane1.setViewportView(ta); frame.add(ta); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); }
Example 8
Source File: OverviewPanel.java From blog with Apache License 2.0 | 5 votes |
public OverviewPanel() { setLayout(null); selectionModel.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); treeSelectionListModelSelectionAdapter .setListModelSelection(listModelSelection); personList.setSelectionModel(selectionModel); personTable.setSelectionModel(selectionModel); personComboBoxModel.setListSelectionModel(selectionModel); personTree.setSelectionModel(treeSelectionListModelSelectionAdapter); ListCellRenderer<Person> personRenderer = new PersonListCellRenderer(); personList.setCellRenderer(personRenderer); personList.setEnabled(true); personsComboBox.setRenderer(personRenderer); personTree.setCellRenderer(new PersonTreeCellRenderer()); personTree.setRootVisible(false); personTable.setSelectionModel(personList.getSelectionModel()); JScrollPane scrollPane = new JScrollPane(); scrollPane.setBounds(10, 11, 580, 130); add(scrollPane); scrollPane.setViewportView(personTable); personsComboBox.setBounds(10, 153, 580, 30); add(personsComboBox); JScrollPane scrollPane_1 = new JScrollPane(); scrollPane_1.setBounds(10, 194, 580, 105); add(scrollPane_1); scrollPane_1.setViewportView(personList); JScrollPane scrollPane_2 = new JScrollPane(); scrollPane_2.setBounds(10, 310, 580, 205); add(scrollPane_2); scrollPane_2.setColumnHeaderView(personTree); }
Example 9
Source File: ServiceUsagePane.java From attic-polygene-java with Apache License 2.0 | 5 votes |
/** * Method generated by IntelliJ IDEA GUI Designer * >>> IMPORTANT!! <<< * DO NOT edit this method OR call it in your code! * */ private void $$$setupUI$$$() { contentPane = new JPanel(); contentPane.setLayout( new BorderLayout( 0, 0 ) ); final JScrollPane scrollPane1 = new JScrollPane(); contentPane.add( scrollPane1, BorderLayout.CENTER ); usageTable = new JTable(); scrollPane1.setViewportView( usageTable ); }
Example 10
Source File: CustomizerTesting.java From netbeans with Apache License 2.0 | 4 votes |
/** * This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The content of this method is always regenerated by the Form * Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { testDirsLabel = new JLabel(); testDirsScrollPane = new JScrollPane(); testDirsList = new JList<BasePathSupport.Item>(); addFolderButton = new JButton(); removeButton = new JButton(); moveUpButton = new JButton(); moveDownButton = new JButton(); providersLabel = new JLabel(); providersPanel = new JPanel(); Mnemonics.setLocalizedText(testDirsLabel, NbBundle.getMessage(CustomizerTesting.class, "CustomizerTesting.testDirsLabel.text")); // NOI18N testDirsScrollPane.setViewportView(testDirsList); Mnemonics.setLocalizedText(addFolderButton, NbBundle.getMessage(CustomizerTesting.class, "CustomizerTesting.addFolderButton.text")); // NOI18N Mnemonics.setLocalizedText(removeButton, NbBundle.getMessage(CustomizerTesting.class, "CustomizerTesting.removeButton.text")); // NOI18N Mnemonics.setLocalizedText(moveUpButton, NbBundle.getMessage(CustomizerTesting.class, "CustomizerTesting.moveUpButton.text")); // NOI18N Mnemonics.setLocalizedText(moveDownButton, NbBundle.getMessage(CustomizerTesting.class, "CustomizerTesting.moveDownButton.text")); // NOI18N Mnemonics.setLocalizedText(providersLabel, NbBundle.getMessage(CustomizerTesting.class, "CustomizerTesting.providersLabel.text")); // NOI18N GroupLayout providersPanelLayout = new GroupLayout(providersPanel); providersPanel.setLayout(providersPanelLayout); providersPanelLayout.setHorizontalGroup( providersPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGap(0, 407, Short.MAX_VALUE) ); providersPanelLayout.setVerticalGroup( providersPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGap(0, 46, Short.MAX_VALUE) ); GroupLayout layout = new GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(providersPanel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(layout.createSequentialGroup() .addComponent(testDirsScrollPane) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(addFolderButton, GroupLayout.Alignment.TRAILING) .addComponent(removeButton, GroupLayout.Alignment.TRAILING) .addComponent(moveUpButton, GroupLayout.Alignment.TRAILING) .addComponent(moveDownButton, GroupLayout.Alignment.TRAILING))) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(testDirsLabel) .addComponent(providersLabel)) .addGap(0, 0, Short.MAX_VALUE)) ); layout.linkSize(SwingConstants.HORIZONTAL, new Component[] {addFolderButton, moveDownButton, moveUpButton, removeButton}); layout.setVerticalGroup( layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(testDirsLabel) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(testDirsScrollPane, GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE) .addGroup(layout.createSequentialGroup() .addComponent(addFolderButton) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(removeButton) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(moveUpButton) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(moveDownButton))) .addGap(18, 18, 18) .addComponent(providersLabel) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(providersPanel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGap(0, 0, 0)) ); }
Example 11
Source File: SpectraIdentificationResultsWindow.java From mzmine2 with GNU General Public License v2.0 | 4 votes |
public SpectraIdentificationResultsWindow() { setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); setSize(new Dimension(1400, 900)); getContentPane().setLayout(new BorderLayout()); setTitle("Processing..."); pnGrid = new JPanel(); // any number of rows pnGrid.setLayout(new GridLayout(0, 1, 0, 0)); pnGrid.setBackground(Color.WHITE); pnGrid.setAutoscrolls(false); noMatchesFound = new JLabel("I'm working on it", SwingConstants.CENTER); noMatchesFound.setFont(headerFont); // yellow noMatchesFound.setForeground(new Color(0xFFCC00)); pnGrid.add(noMatchesFound, BorderLayout.CENTER); // Add the Windows menu JMenuBar menuBar = new JMenuBar(); menuBar.add(new WindowsMenu()); // set font size of chart JMenuItem btnSetup = new JMenuItem("Setup dialog"); btnSetup.addActionListener(e -> { if (MZmineCore.getConfiguration() .getModuleParameters(SpectraIdentificationResultsModule.class) .showSetupDialog(this, true) == ExitCode.OK) { showExportButtonsChanged(); } }); menuBar.add(btnSetup); JCheckBoxMenuItem cbCoupleZoomY = new JCheckBoxMenuItem("Couple y-zoom"); cbCoupleZoomY.setSelected(true); cbCoupleZoomY.addItemListener(e -> setCoupleZoomY(cbCoupleZoomY.isSelected())); menuBar.add(cbCoupleZoomY); JMenuItem btnSetFont = new JMenuItem("Set chart font"); btnSetFont.addActionListener(e -> setChartFont()); menuBar.add(btnSetFont); setJMenuBar(menuBar); scrollPane = new JScrollPane(pnGrid); getContentPane().add(scrollPane, BorderLayout.CENTER); scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); scrollPane.setViewportView(pnGrid); totalMatches = new ArrayList<>(); matchPanels = new HashMap<>(); setCoupleZoomY(true); setVisible(true); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); validate(); repaint(); }
Example 12
Source File: WebSocketFuzzResultsContentPanel.java From zap-extensions with Apache License 2.0 | 4 votes |
public WebSocketFuzzResultsContentPanel() { super(new BorderLayout()); toolbar = new JToolBar(); toolbar.setFloatable(false); toolbar.setRollover(true); messageCountLabel = new JLabel( Constant.messages.getString( "websocket.fuzzer.results.toolbar.messagesSent")); messageCountValueLabel = new JLabel("0"); errorCountLabel = new JLabel(Constant.messages.getString("websocket.fuzzer.results.toolbar.errors")); errorCountValueLabel = new JLabel("0"); toolbar.add(Box.createHorizontalStrut(4)); toolbar.add(messageCountLabel); toolbar.add(Box.createHorizontalStrut(4)); toolbar.add(messageCountValueLabel); toolbar.add(Box.createHorizontalStrut(32)); toolbar.add(errorCountLabel); toolbar.add(Box.createHorizontalStrut(4)); toolbar.add(errorCountValueLabel); mainPanel = new JPanel(new BorderLayout()); fuzzResultTable = new WebSocketFuzzMessagesView(EMPTY_RESULTS_MODEL); fuzzResultTable.setDisplayPanel( View.getSingleton().getRequestPanel(), View.getSingleton().getResponsePanel()); fuzzResultTableScrollPane = new JScrollPane(); fuzzResultTableScrollPane.setViewportView(fuzzResultTable.getViewComponent()); fuzzResultTableScrollPane .getVerticalScrollBar() .addAdjustmentListener(new StickyScrollbarAdjustmentListener()); mainPanel.add(fuzzResultTableScrollPane); add(toolbar, BorderLayout.PAGE_START); add(mainPanel, BorderLayout.CENTER); }
Example 13
Source File: ClassPathForm.java From PyramidShader with GNU General Public License v3.0 | 4 votes |
public JPanel createPanel() { JPanel jpanel1 = new JPanel(); FormLayout formlayout1 = new FormLayout("FILL:7DLU:NONE,RIGHT:MAX(65DLU;DEFAULT):NONE,FILL:3DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:3DLU:NONE,FILL:DEFAULT:NONE,FILL:3DLU:NONE,FILL:DEFAULT:NONE,FILL:3DLU:NONE,FILL:DEFAULT:NONE,FILL:3DLU:NONE,FILL:26PX:NONE,FILL:7DLU:NONE","CENTER:9DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:GROW(1.0),CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:9DLU:NONE"); CellConstraints cc = new CellConstraints(); jpanel1.setLayout(formlayout1); _classpathField.setName("classpathField"); jpanel1.add(_classpathField,cc.xywh(4,11,7,1)); _classpathFieldLabel.setIcon(loadImage("images/asterix.gif")); _classpathFieldLabel.setName("classpathFieldLabel"); _classpathFieldLabel.setText(Messages.getString("editClassPath")); jpanel1.add(_classpathFieldLabel,cc.xy(2,11)); _classpathListLabel.setName("classpathListLabel"); _classpathListLabel.setText(Messages.getString("classPath")); jpanel1.add(_classpathListLabel,cc.xy(2,6)); _classpathList.setName("classpathList"); JScrollPane jscrollpane1 = new JScrollPane(); jscrollpane1.setViewportView(_classpathList); jscrollpane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); jscrollpane1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); jpanel1.add(jscrollpane1,cc.xywh(4,6,7,4)); _mainclassLabel.setIcon(loadImage("images/asterix.gif")); _mainclassLabel.setName("mainclassLabel"); _mainclassLabel.setText(Messages.getString("mainClass")); jpanel1.add(_mainclassLabel,cc.xy(2,4)); _mainclassField.setName("mainclassField"); jpanel1.add(_mainclassField,cc.xywh(4,4,7,1)); _acceptClasspathButton.setActionCommand("Add"); _acceptClasspathButton.setIcon(loadImage("images/ok16.png")); _acceptClasspathButton.setName("acceptClasspathButton"); _acceptClasspathButton.setText(Messages.getString("accept")); jpanel1.add(_acceptClasspathButton,cc.xy(8,13)); _removeClasspathButton.setActionCommand("Remove"); _removeClasspathButton.setIcon(loadImage("images/cancel16.png")); _removeClasspathButton.setName("removeClasspathButton"); _removeClasspathButton.setText(Messages.getString("remove")); jpanel1.add(_removeClasspathButton,cc.xy(10,13)); _importClasspathButton.setIcon(loadImage("images/open16.png")); _importClasspathButton.setName("importClasspathButton"); _importClasspathButton.setToolTipText(Messages.getString("importClassPath")); jpanel1.add(_importClasspathButton,cc.xy(12,4)); _classpathUpButton.setIcon(loadImage("images/up16.png")); _classpathUpButton.setName("classpathUpButton"); jpanel1.add(_classpathUpButton,cc.xy(12,6)); _classpathDownButton.setIcon(loadImage("images/down16.png")); _classpathDownButton.setName("classpathDownButton"); jpanel1.add(_classpathDownButton,cc.xy(12,8)); _classpathCheck.setActionCommand("Custom classpath"); _classpathCheck.setName("classpathCheck"); _classpathCheck.setText(Messages.getString("customClassPath")); jpanel1.add(_classpathCheck,cc.xy(4,2)); _newClasspathButton.setActionCommand("New"); _newClasspathButton.setIcon(loadImage("images/new16.png")); _newClasspathButton.setName("newClasspathButton"); _newClasspathButton.setText(Messages.getString("new")); jpanel1.add(_newClasspathButton,cc.xy(6,13)); addFillComponents(jpanel1,new int[]{ 1,2,3,4,5,6,7,8,9,10,11,12,13 },new int[]{ 1,2,3,4,5,6,7,8,9,10,11,12,13,14 }); return jpanel1; }
Example 14
Source File: JreForm.java From beast-mcmc with GNU Lesser General Public License v2.1 | 4 votes |
public JPanel createPanel() { JPanel jpanel1 = new JPanel(); FormLayout formlayout1 = new FormLayout("FILL:7DLU:NONE,RIGHT:MAX(65DLU;DEFAULT):NONE,FILL:3DLU:NONE,FILL:60DLU:NONE,FILL:3DLU:NONE,FILL:DEFAULT:NONE,FILL:7DLU:NONE,FILL:60DLU:NONE,FILL:3DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:7DLU:NONE","CENTER:9DLU:NONE,CENTER:DEFAULT:NONE,CENTER:9DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:9DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,FILL:50DLU:GROW(1.0),CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:9DLU:NONE"); CellConstraints cc = new CellConstraints(); jpanel1.setLayout(formlayout1); _jrePathLabel.setName("jrePathLabel"); _jrePathLabel.setText(Messages.getString("jrePath")); jpanel1.add(_jrePathLabel,cc.xy(2,2)); _jreMinLabel.setName("jreMinLabel"); _jreMinLabel.setText(Messages.getString("jreMin")); jpanel1.add(_jreMinLabel,cc.xy(2,6)); _jreMaxLabel.setName("jreMaxLabel"); _jreMaxLabel.setText(Messages.getString("jreMax")); jpanel1.add(_jreMaxLabel,cc.xy(2,8)); _jvmOptionsTextLabel.setName("jvmOptionsTextLabel"); _jvmOptionsTextLabel.setText(Messages.getString("jvmOptions")); jpanel1.add(_jvmOptionsTextLabel,new CellConstraints(2,16,1,1,CellConstraints.DEFAULT,CellConstraints.TOP)); _jreMinField.setName("jreMinField"); jpanel1.add(_jreMinField,cc.xy(4,6)); _jreMaxField.setName("jreMaxField"); jpanel1.add(_jreMaxField,cc.xy(4,8)); _jvmOptionsTextArea.setName("jvmOptionsTextArea"); _jvmOptionsTextArea.setToolTipText(Messages.getString("jvmOptionsTip")); JScrollPane jscrollpane1 = new JScrollPane(); jscrollpane1.setViewportView(_jvmOptionsTextArea); jscrollpane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); jscrollpane1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); jpanel1.add(jscrollpane1,cc.xywh(4,16,7,1)); _initialHeapSizeLabel.setName("initialHeapSizeLabel"); _initialHeapSizeLabel.setText(Messages.getString("initialHeapSize")); jpanel1.add(_initialHeapSizeLabel,cc.xy(2,12)); _maxHeapSizeLabel.setName("maxHeapSizeLabel"); _maxHeapSizeLabel.setText(Messages.getString("maxHeapSize")); jpanel1.add(_maxHeapSizeLabel,cc.xy(2,14)); JLabel jlabel1 = new JLabel(); jlabel1.setText("MB"); jpanel1.add(jlabel1,cc.xy(6,12)); JLabel jlabel2 = new JLabel(); jlabel2.setText("MB"); jpanel1.add(jlabel2,cc.xy(6,14)); _initialHeapSizeField.setName("initialHeapSizeField"); jpanel1.add(_initialHeapSizeField,cc.xy(4,12)); _maxHeapSizeField.setName("maxHeapSizeField"); jpanel1.add(_maxHeapSizeField,cc.xy(4,14)); _maxHeapPercentField.setName("maxHeapPercentField"); jpanel1.add(_maxHeapPercentField,cc.xy(8,14)); _initialHeapPercentField.setName("initialHeapPercentField"); jpanel1.add(_initialHeapPercentField,cc.xy(8,12)); _jdkPreferenceCombo.setName("jdkPreferenceCombo"); jpanel1.add(_jdkPreferenceCombo,cc.xywh(8,6,3,1)); JLabel jlabel3 = new JLabel(); jlabel3.setText(Messages.getString("availableMemory")); jpanel1.add(jlabel3,cc.xy(10,12)); JLabel jlabel4 = new JLabel(); jlabel4.setText(Messages.getString("availableMemory")); jpanel1.add(jlabel4,cc.xy(10,14)); _runtimeBitsCombo.setName("runtimeBitsCombo"); _runtimeBitsCombo.setToolTipText(""); jpanel1.add(_runtimeBitsCombo,cc.xywh(8,8,3,1)); jpanel1.add(createPanel1(),cc.xywh(2,18,9,1)); TitledSeparator titledseparator1 = new TitledSeparator(); titledseparator1.setText(Messages.getString("searchOptions")); jpanel1.add(titledseparator1,cc.xywh(2,4,9,1)); TitledSeparator titledseparator2 = new TitledSeparator(); titledseparator2.setText(Messages.getString("options")); jpanel1.add(titledseparator2,cc.xywh(2,10,9,1)); jpanel1.add(createPanel2(),cc.xywh(4,2,7,1)); addFillComponents(jpanel1,new int[]{ 1,2,3,4,5,6,7,8,9,10,11 },new int[]{ 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19 }); return jpanel1; }
Example 15
Source File: LibraryPanel.java From HubPlayer with GNU General Public License v3.0 | 4 votes |
/** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings({ "unchecked", "serial" }) // <editor-fold defaultstate="collapsed" desc="Generated Code"> private void initComponents() { aScrollPanel = new JScrollPane(); dataTable = new JTable(); libraryTableModel = new LibraryTableModel(); libraryOperation = new LibraryOperation(); aToolBar = new JToolBar(); moreSearch = new JButton(); setLayout(new BorderLayout()); aScrollPanel .setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); aScrollPanel .setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); aScrollPanel.setMaximumSize(new Dimension(615, 481)); // 设置20行空数据 dataTable.setModel(libraryTableModel); libraryTableModel.setLibraryOperation(libraryOperation); // 定义"操作栏"的渲染器 显示按钮 dataTable.getColumn("操作").setCellRenderer( new DefaultTableCellRenderer() { @Override public Component getTableCellRendererComponent( JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { return value instanceof JPanel ? (JPanel) value : super .getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); } }); // 定义"操作栏"的编辑器 响应按钮事件 dataTable.getColumn("操作").setCellEditor(new CellEditor()); dataTable.setColumnSelectionAllowed(true); dataTable.setRowHeight(23); aScrollPanel.setViewportView(dataTable); dataTable.getColumnModel().getSelectionModel() .setSelectionMode(ListSelectionModel.SINGLE_SELECTION); add(aScrollPanel, BorderLayout.CENTER); aToolBar.setFloatable(false); aToolBar.setRollover(true); aToolBar.setOpaque(false); moreSearch.setText("更多数据"); moreSearch.setFocusable(false); moreSearch.setHorizontalTextPosition(SwingConstants.CENTER); moreSearch.setVerticalTextPosition(SwingConstants.BOTTOM); // moreSearch.setEnabled(false); aToolBar.add(moreSearch); Box box = Box.createVerticalBox(); box.setBorder(BorderFactory.createLineBorder(Color.BLACK)); box.setOpaque(true); box.add(aToolBar); add(box, BorderLayout.SOUTH); }
Example 16
Source File: MaintenanceTabPanel.java From mars-sim with GNU General Public License v3.0 | 4 votes |
public void initializeUI() { uiDone = true; Malfunctionable malfunctionable = (Malfunctionable) unit; MalfunctionManager manager = malfunctionable.getMalfunctionManager(); // Create maintenance label. JPanel mpanel = new JPanel(new FlowLayout(FlowLayout.CENTER)); JLabel maintenanceLabel = new JLabel(Msg.getString("MaintenanceTabPanel.title", JLabel.CENTER)); maintenanceLabel.setFont(new Font("Serif", Font.BOLD, 16)); mpanel.add(maintenanceLabel); topContentPanel.add(mpanel); // Create maintenance panel JPanel maintenancePanel = new JPanel(new GridLayout(6, 1, 0, 0)); maintenancePanel.setBorder(new MarsPanelBorder()); topContentPanel.add(maintenancePanel); // Create wear condition label. wearConditionCache = (int) Math.round(manager.getWearCondition()); wearConditionLabel = new JLabel("Condition: " + wearConditionCache + "%", JLabel.CENTER); wearConditionLabel.setToolTipText("The health condition due to wear & tear : 100% = new; 0% = worn out"); maintenancePanel.add(wearConditionLabel); // Create lastCompletedLabel. lastCompletedTime = (int) (manager.getTimeSinceLastMaintenance() / 1000D); lastCompletedLabel = new JLabel("Last Completed: " + lastCompletedTime + " sols", JLabel.CENTER); maintenancePanel.add(lastCompletedLabel); // Create maintenance progress bar panel. JPanel progressPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 0)); maintenancePanel.add(progressPanel); // Prepare maintenance parts label. partsLabel = new JLabel(getPartsString(false), JLabel.CENTER); partsLabel.setPreferredSize(new Dimension(-1, -1)); maintenancePanel.add(partsLabel); // Prepare progress bar. JProgressBar progressBar = new JProgressBar(); progressBarModel = progressBar.getModel(); progressBar.setStringPainted(true); progressPanel.add(progressBar); // Set initial value for progress bar. double completed = manager.getMaintenanceWorkTimeCompleted(); double total = manager.getMaintenanceWorkTime(); int percentDone = (int) (100D * (completed / total)); progressBarModel.setValue(percentDone); // Prepare malfunction panel JPanel malfunctionPanel = new JPanel(new BorderLayout(0, 0)); // malfunctionPanel.setBorder(new MarsPanelBorder()); centerContentPanel.add(malfunctionPanel, BorderLayout.CENTER); // Create malfunctions label JLabel malfunctionsLabel = new JLabel("Malfunctions", JLabel.CENTER); malfunctionPanel.add(malfunctionsLabel, BorderLayout.NORTH); // Create scroll panel for malfunction list JScrollPane malfunctionScrollPanel = new JScrollPane(); malfunctionScrollPanel.setPreferredSize(new Dimension(170, 90)); malfunctionPanel.add(malfunctionScrollPanel, BorderLayout.CENTER); // Create malfunction list main panel. JPanel malfunctionListMainPanel = new JPanel(new BorderLayout(0, 0)); malfunctionScrollPanel.setViewportView(malfunctionListMainPanel); // Create malfunction list panel malfunctionListPanel = new JPanel(); malfunctionListPanel.setLayout(new BoxLayout(malfunctionListPanel, BoxLayout.Y_AXIS)); malfunctionListMainPanel.add(malfunctionListPanel, BorderLayout.NORTH); // Create malfunction panels malfunctionCache = malfunctionable.getMalfunctionManager().getMalfunctions(); malfunctionPanels = new ArrayList<MalfunctionPanel>(); Iterator<Malfunction> i = malfunctionCache.iterator(); while (i.hasNext()) { MalfunctionPanel panel = new MalfunctionPanel(i.next()); malfunctionListPanel.add(panel); malfunctionPanels.add(panel); } }
Example 17
Source File: RasterStyleView.java From hortonmachine with GNU General Public License v3.0 | 4 votes |
public JPanel createPanel() { JPanel jpanel1 = new JPanel(); FormLayout formlayout1 = new FormLayout("FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:DEFAULT:GROW(0.3),FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:GROW(1.0),FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:NONE","CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,FILL:DEFAULT:GROW(0.5),CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE"); CellConstraints cc = new CellConstraints(); jpanel1.setLayout(formlayout1); _selectColorTableLabel.setName("selectColorTableLabel"); _selectColorTableLabel.setText("Select Colortable"); jpanel1.add(_selectColorTableLabel,cc.xy(2,4)); _colortablesCombo.setName("colortablesCombo"); jpanel1.add(_colortablesCombo,cc.xywh(4,4,10,1)); _applyTableButton.setActionCommand("Apply"); _applyTableButton.setName("applyTableButton"); _applyTableButton.setText("Apply"); jpanel1.add(_applyTableButton,cc.xy(15,4)); _customStyleLabel.setName("customStyleLabel"); _customStyleLabel.setText("Define custom"); jpanel1.add(_customStyleLabel,new CellConstraints(2,6,1,1,CellConstraints.DEFAULT,CellConstraints.CENTER)); _customStyleArea.setName("customStyleArea"); _customStyleArea.setRows(8); JScrollPane jscrollpane1 = new JScrollPane(); jscrollpane1.setViewportView(_customStyleArea); jscrollpane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); jscrollpane1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); jpanel1.add(jscrollpane1,cc.xywh(4,6,10,1)); _customStyleButton.setActionCommand("Apply"); _customStyleButton.setName("customStyleButton"); _customStyleButton.setText("Apply"); jpanel1.add(_customStyleButton,new CellConstraints(15,6,1,1,CellConstraints.DEFAULT,CellConstraints.CENTER)); jpanel1.add(createPanel1(),cc.xywh(2,2,14,1)); _selectColorTableLabel1.setName("selectColorTableLabel"); _selectColorTableLabel1.setText("Add shaded relief"); jpanel1.add(_selectColorTableLabel1,cc.xy(2,9)); _shadedReliefCheck.setName("shadedReliefCheck"); jpanel1.add(_shadedReliefCheck,cc.xy(4,9)); jpanel1.add(createPanel2(),cc.xywh(7,9,7,1)); addFillComponents(jpanel1,new int[]{ 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16 },new int[]{ 1,2,3,4,5,6,7,8,9,10,11 }); return jpanel1; }
Example 18
Source File: MagicOverviewDialog.java From WorldGrower with GNU General Public License v3.0 | 4 votes |
public MagicOverviewDialog(WorldObject playerCharacter, ImageInfoReader imageInfoReader, SoundIdReader soundIdReader, JFrame parentFrame) { setModalityType(ModalityType.APPLICATION_MODAL); contentPanel = new TiledImagePanel(imageInfoReader); int width = 900; int height = 850; setSize(width, height); contentPanel.setPreferredSize(new Dimension(width, height)); setLocationRelativeTo(null); getContentPane().setLayout(new BorderLayout()); contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); getContentPane().add(contentPanel, BorderLayout.CENTER); contentPanel.setLayout(null); setUndecorated(true); IconUtils.setIcon(this); setCursor(Cursors.CURSOR); JScrollPane scrollPane = new JScrollPane(); scrollPane.setBounds(12, 13, 871, 767); contentPanel.add(scrollPane); JTable magicSpellsTable = new MagicSpellsTable(new MagicSpellTableModel(playerCharacter)); magicSpellsTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); magicSpellsTable.setDefaultRenderer(SkillProperty.class, new SkillTableRenderer(imageInfoReader)); magicSpellsTable.setDefaultRenderer(ImageIds.class, new ImageTableRenderer(imageInfoReader)); magicSpellsTable.setRowHeight(50); magicSpellsTable.setAutoCreateRowSorter(true); magicSpellsTable.getRowSorter().toggleSortOrder(1); magicSpellsTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); magicSpellsTable.getColumnModel().getColumn(0).setPreferredWidth(50); magicSpellsTable.getColumnModel().getColumn(1).setPreferredWidth(257); magicSpellsTable.getColumnModel().getColumn(2).setPreferredWidth(150); magicSpellsTable.getColumnModel().getColumn(3).setPreferredWidth(145); magicSpellsTable.getColumnModel().getColumn(4).setPreferredWidth(100); magicSpellsTable.getColumnModel().getColumn(5).setPreferredWidth(150); JTableFactory.applyImageToHeaderColumn(magicSpellsTable, magicSpellsTable.getColumnModel().getColumn(5), ImageIds.SMALL_TURN, imageInfoReader); scrollPane.setViewportView(magicSpellsTable); JPanel buttonPane = new JPanel(); buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); buttonPane.setOpaque(false); buttonPane.setBounds(12, 790, 878, 75); contentPanel.add(buttonPane); JButton okButton = JButtonFactory.createButton("OK", imageInfoReader, soundIdReader); okButton.setActionCommand("OK"); buttonPane.add(okButton); getRootPane().setDefaultButton(okButton); okButton.addActionListener(new CloseDialogAction()); SwingUtils.installEscapeCloseOperation(this); SwingUtils.makeTransparant(magicSpellsTable, scrollPane); DialogUtils.createDialogBackPanel(this, parentFrame.getContentPane()); }
Example 19
Source File: DataInstaller.java From pcgen with GNU Lesser General Public License v2.1 | 4 votes |
/** * Build the user interface ready for display. */ private void initComponents() { GridBagConstraints gbc = new GridBagConstraints(); gbc.fill = GridBagConstraints.HORIZONTAL; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(2, 2, 2, 2); GridBagLayout gridbag = new GridBagLayout(); setTitle(TITLE); setLayout(gridbag); // Data set selection row Utility.buildConstraints(gbc, 0, 0, 1, 1, 0.0, 0.0); JLabel dataSetLabel = new JLabel(LanguageBundle.getString("in_diDataSet"), SwingConstants.RIGHT); gridbag.setConstraints(dataSetLabel, gbc); add(dataSetLabel, gbc); Utility.buildConstraints(gbc, 1, 0, 2, 1, 1.0, 0.0); dataSetSel = new JTextField("", SwingConstants.WEST); dataSetSel.setEditable(false); gridbag.setConstraints(dataSetSel, gbc); add(dataSetSel, gbc); Utility.buildConstraints(gbc, 3, 0, 1, 1, 0.0, 0.0); gbc.fill = GridBagConstraints.NONE; selectButton = new JButton(); CommonMenuText.name(selectButton, "select"); //$NON-NLS-1$ gridbag.setConstraints(selectButton, gbc); add(selectButton, gbc); selectButton.addActionListener(listener); // Data set details row Utility.buildConstraints(gbc, 0, 1, 4, 1, 1.0, 1.0); dataSetDetails = new JFXPanelFromResource<>( SimpleHtmlPanelController.class, "SimpleHtmlPanel.fxml" ); dataSetDetails.setPreferredSize(new Dimension(400, 200)); dataSetDetails.setBackground(getBackground()); gbc.fill = GridBagConstraints.BOTH; JScrollPane jScrollPane = new JScrollPane(); jScrollPane.setViewportView(dataSetDetails); gridbag.setConstraints(jScrollPane, gbc); add(jScrollPane, gbc); // Location row Utility.buildConstraints(gbc, 0, 2, 1, 1, 0.0, 0.0); gbc.fill = GridBagConstraints.HORIZONTAL; JLabel locLabel = new JLabel(LanguageBundle.getString("in_diLocation"), SwingConstants.RIGHT); gridbag.setConstraints(locLabel, gbc); add(locLabel, gbc); ButtonGroup exclusiveGroup = new ButtonGroup(); locDataButton = new JRadioButton(LanguageBundle.getString("in_diData")); locDataButton.setToolTipText(LanguageBundle.getString("in_diData_tip")); exclusiveGroup.add(locDataButton); locVendorDataButton = new JRadioButton(LanguageBundle.getString("in_diVendorData")); locVendorDataButton.setToolTipText(LanguageBundle.getString("in_diVendorData_tip")); exclusiveGroup.add(locVendorDataButton); locHomebrewDataButton = new JRadioButton(LanguageBundle.getString("in_diHomebrewData")); locHomebrewDataButton.setToolTipText(LanguageBundle.getString("in_diHomebrewData_tip")); exclusiveGroup.add(locHomebrewDataButton); JPanel optionsPanel = new JPanel(); optionsPanel.add(locDataButton); optionsPanel.add(locVendorDataButton); optionsPanel.add(locHomebrewDataButton); Utility.buildConstraints(gbc, 1, 2, 3, 1, 0.0, 0.0); gridbag.setConstraints(optionsPanel, gbc); gbc.fill = GridBagConstraints.NONE; gbc.anchor = GridBagConstraints.WEST; add(optionsPanel, gbc); // Buttons row installButton = new JButton(); CommonMenuText.name(installButton, "diInstall"); //$NON-NLS-1$ installButton.addActionListener(listener); closeButton = new JButton(); CommonMenuText.name(closeButton, "close"); //$NON-NLS-1$ closeButton.addActionListener(listener); JPanel buttonsPanel = new JPanel(); buttonsPanel.add(installButton); buttonsPanel.add(closeButton); Utility.buildConstraints(gbc, 2, 3, 2, 1, 0.0, 0.0); gridbag.setConstraints(buttonsPanel, gbc); gbc.fill = GridBagConstraints.NONE; gbc.anchor = GridBagConstraints.EAST; add(buttonsPanel, gbc); pack(); }
Example 20
Source File: TableEditor.java From ramus with GNU General Public License v3.0 | 4 votes |
@Override public JComponent getComponent() { pane = new JScrollPane(); pane.setViewportView(editorTable); header = new TableHeader(editorTable, model); header.setDragEnabled(true); header.setTransferHandler(new RowTransferHandle()); header.setDropMode(DropMode.INSERT); pane.setRowHeaderView(header); editorTable.setDropMode(DropMode.INSERT_ROWS); editorTable.setTransferHandler(new RowTransferHandle()); return pane; }