List of usage examples for javax.swing JScrollPane setViewportView
public void setViewportView(Component view)
From source file:nl.detoren.ijsco.ui.Mainscreen.java
public JPanel createPanelScenarios() { JPanel panel = new JPanel(); panel.setBackground(Color.RED); panel.setLayout(new GridLayout(1, 0)); schemaModel = new SchemaModel(panel, status.schemas); schemaTabel = new JTable(schemaModel) { @Override//from w w w . j a v a 2 s . c om public Component prepareRenderer(TableCellRenderer renderer, int row, int column) { Component c = super.prepareRenderer(renderer, row, column); // Tooltip if (c instanceof JComponent) { SchemaModel model = (SchemaModel) getModel(); ((JComponent) c).setToolTipText(model.getToolTip(row, column).toString()); } // Alternate row color if (!isRowSelected(row)) { c.setBackground(row % 2 == 0 ? Color.WHITE : Color.LIGHT_GRAY); } return c; } }; schemaTabel.getModel().addTableModelListener(new TableModelListener() { @Override public void tableChanged(TableModelEvent arg0) { panel.getParent().getParent().repaint(); } }); JScrollPane scrollpane = new JScrollPane(); scrollpane.setViewportView(schemaTabel); //panel.add(scrollpane, new ExtendedGridConstraints(0, 2)); panel.add(scrollpane); return panel; }
From source file:nl.detoren.ijsco.ui.Mainscreen.java
public JPanel createDeelnemersPanel() { JPanel panel = new JPanel(false); panel.setBackground(Color.BLACK); //panel.setLayout(new GridLayout(1, 0)); panel.setLayout(new BorderLayout()); JPanel innerPanel = new JPanel(); JLabel lbAanwezig = new JLabel("Deelnemers: "); innerPanel.add(lbAanwezig, BorderLayout.NORTH); tfAanwezig = new JLabel(Integer.toString(status.deelnemers.aantalAanwezig()), 10); innerPanel.add(tfAanwezig, BorderLayout.NORTH); //innerPanel.setLayout(new GridLayout(1, 0)); innerPanel.add(new JLabel("Naam:"), BorderLayout.NORTH); JTextField deelnemer = new JTextField(15); ArrayList<String> words = new ArrayList<>(); if (status.OSBOSpelers != null) { for (Speler s : status.OSBOSpelers.values()) { words.add(s.getNaam().trim()); words.add(Integer.toString(s.getKnsbnummer())); }//from w w w . j a v a 2 s . c o m } @SuppressWarnings("unused") Suggesties suggesties = new Suggesties(deelnemer, this, words, 2); innerPanel.add(deelnemer, BorderLayout.NORTH); deelnemer.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { actieVoegSpelerToe(deelnemer.getText().trim()); deelnemer.setText(""); } }); JButton btVoegToe = new JButton("Voeg toe"); btVoegToe.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { actieVoegSpelerToe(deelnemer.getText().trim()); deelnemer.setText(""); } }); innerPanel.add(btVoegToe); panel.add(innerPanel); // panel_deelnemers.add(new JLabel("Deelnemers IJSCO toernooi")); deelnemersModel = new DeelnemersModel(panel, status.deelnemers); JTable deelnemersTabel = new JTable(deelnemersModel) { private static final long serialVersionUID = -8293073016982337108L; @Override public Component prepareRenderer(TableCellRenderer renderer, int row, int column) { Component c = super.prepareRenderer(renderer, row, column); DeelnemersModel model = (DeelnemersModel) getModel(); // Tooltip if (c instanceof JComponent) { ((JComponent) c) .setToolTipText(model.getToolTip(convertRowIndexToModel(row), column).toString()); } // Alternate row color if (!isRowSelected(row)) { c.setBackground(row % 2 == 0 ? Color.WHITE : Color.LIGHT_GRAY); } // Highlight overruled entries if (status.deelnemers.get(convertRowIndexToModel(row)).isOverruleNaam() || status.deelnemers.get(convertRowIndexToModel(row)).isOverruleNaam()) { c.setForeground(Color.BLUE); } else { c.setForeground(Color.BLACK); } return c; } }; deelnemersTabel.getModel().addTableModelListener(new TableModelListener() { @Override public void tableChanged(TableModelEvent arg0) { status.groepen = null; status.schemas = null; status.schema = null; groepenText.setText(""); schemaModel.setSchemas(null); schemaModel.fireTableDataChanged(); if (status.deelnemers != null && tfAanwezig != null) { tfAanwezig.setText(Integer.toString(status.deelnemers.aantalAanwezig())); } panel.repaint(); } }); deelnemersTabel.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { logger.log(Level.INFO, "MouseEvent on table fired, type : " + e.toString()); logger.log(Level.INFO, "Popup trigger? : " + e.isPopupTrigger()); if (e.isPopupTrigger()) { int row = deelnemersTabel.rowAtPoint(e.getPoint()); JPopupMenu popup = new JPopupMenu(); JMenuItem menuItem = new JMenuItem("Bewerk speler"); menuItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { logger.log(Level.INFO, "Bewerk Speler : " + deelnemersTabel.convertRowIndexToModel(row)); Speler s = status.deelnemers.get(deelnemersTabel.convertRowIndexToModel(row)); BewerkSpelerDialoog rd = new BewerkSpelerDialoog(new JFrame(), "Bewerk Speler", s, deelnemersModel); rd.addWindowListener(new WindowAdapter() { @Override public void windowClosed(WindowEvent e) { System.out.println("closing..."); } }); rd.setVisible(true); } }); popup.add(menuItem); menuItem = new JMenuItem("Verwijder Speler"); popup.add(menuItem); menuItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { logger.log(Level.INFO, "Verwijder Speler : " + deelnemersTabel.convertRowIndexToModel(row)); Speler s = status.deelnemers.get(deelnemersTabel.convertRowIndexToModel(row)); status.deelnemers.remove(s); deelnemersModel.fireTableDataChanged(); } }); popup.show(e.getComponent(), e.getX(), e.getY()); } } }); JScrollPane scrollPane = new JScrollPane(); scrollPane.setViewportView(deelnemersTabel); innerPanel.add(scrollPane, BorderLayout.CENTER); TableRowSorter<TableModel> sorter = new TableRowSorter<TableModel>(deelnemersModel); deelnemersTabel.setRowSorter(sorter); innerPanel.add(new JLabel("Filter op : ")); JTextField tfFilter = new JTextField(10); tfFilter.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { String text = tfFilter.getText(); logger.log(Level.INFO, "Filter tabel op : " + text); if (text.length() == 0) { sorter.setRowFilter(null); } else { sorter.setRowFilter(RowFilter.regexFilter("(?i)" + text)); } } }); innerPanel.add(tfFilter); JButton btPasToe = new JButton("Apply"); btPasToe.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { String text = tfFilter.getText(); logger.log(Level.INFO, "Filter tabel op : " + text); if (text.length() == 0) { sorter.setRowFilter(null); } else { sorter.setRowFilter(RowFilter.regexFilter("(?i)" + text)); } } }); innerPanel.add(btPasToe); JButton btWis = new JButton("Wis"); btWis.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { tfFilter.setText(""); logger.log(Level.INFO, "Wis filter"); sorter.setRowFilter(null); } }); innerPanel.add(btWis); Utils.fixedColumSize(deelnemersTabel.getColumnModel().getColumn(0), 30); Utils.fixedColumSize(deelnemersTabel.getColumnModel().getColumn(1), 55); Utils.fixedColumSize(deelnemersTabel.getColumnModel().getColumn(2), 170); Utils.fixedColumSize(deelnemersTabel.getColumnModel().getColumn(3), 40); Utils.fixedColumSize(deelnemersTabel.getColumnModel().getColumn(4), 40); Utils.fixedColumSize(deelnemersTabel.getColumnModel().getColumn(5), 30); Utils.fixedComponentSize(scrollPane, 400, 580); return panel; }
From source file:org.apache.pdfbox.debugger.PDFDebugger.java
/** * This method is called from within the constructor to initialize the form. *///from ww w. j a v a 2 s .com private void initComponents() { jSplitPane1 = new javax.swing.JSplitPane(); jScrollPane1 = new JScrollPane(); tree = new Tree(this); jScrollPane2 = new JScrollPane(); jTextPane1 = new javax.swing.JTextPane(); tree.setCellRenderer(new PDFTreeCellRenderer()); tree.setModel(null); setTitle("Apache PDFBox Debugger"); addWindowListener(new java.awt.event.WindowAdapter() { @Override public void windowOpened(WindowEvent windowEvent) { tree.requestFocusInWindow(); super.windowOpened(windowEvent); } @Override public void windowClosing(WindowEvent evt) { exitForm(evt); } }); jScrollPane1.setBorder(new BevelBorder(BevelBorder.RAISED)); jScrollPane1.setPreferredSize(new Dimension(350, 500)); tree.addTreeSelectionListener(new TreeSelectionListener() { @Override public void valueChanged(TreeSelectionEvent evt) { jTree1ValueChanged(evt); } }); jScrollPane1.setViewportView(tree); jSplitPane1.setRightComponent(jScrollPane2); jSplitPane1.setDividerSize(3); jScrollPane2.setPreferredSize(new Dimension(300, 500)); jScrollPane2.setViewportView(jTextPane1); jSplitPane1.setLeftComponent(jScrollPane1); JScrollPane documentScroller = new JScrollPane(); documentScroller.setViewportView(documentPanel); statusPane = new TreeStatusPane(tree); statusPane.getPanel().setBorder(new BevelBorder(BevelBorder.RAISED)); statusPane.getPanel().setPreferredSize(new Dimension(300, 25)); getContentPane().add(statusPane.getPanel(), BorderLayout.PAGE_START); getContentPane().add(jSplitPane1, BorderLayout.CENTER); statusBar = new ReaderBottomPanel(); getContentPane().add(statusBar, BorderLayout.SOUTH); // create menus JMenuBar menuBar = new JMenuBar(); menuBar.add(createFileMenu()); menuBar.add(createEditMenu()); menuBar.add(createViewMenu()); setJMenuBar(menuBar); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); int width = 1000; int height = 970; setBounds((screenSize.width - width) / 2, (screenSize.height - height) / 2, width, height); // drag and drop to open files setTransferHandler(new TransferHandler() { @Override public boolean canImport(TransferSupport transferSupport) { return transferSupport.isDataFlavorSupported(DataFlavor.javaFileListFlavor); } @Override @SuppressWarnings("unchecked") public boolean importData(TransferSupport transferSupport) { try { Transferable transferable = transferSupport.getTransferable(); List<File> files = (List<File>) transferable.getTransferData(DataFlavor.javaFileListFlavor); readPDFFile(files.get(0), ""); return true; } catch (IOException e) { new ErrorDialog(e).setVisible(true); return true; } catch (UnsupportedFlavorException e) { throw new RuntimeException(e); } } }); // Mac OS X file open/quit handler if (IS_MAC_OS) { try { Method osxOpenFiles = getClass().getDeclaredMethod("osxOpenFiles", String.class); osxOpenFiles.setAccessible(true); OSXAdapter.setFileHandler(this, osxOpenFiles); Method osxQuit = getClass().getDeclaredMethod("osxQuit"); osxQuit.setAccessible(true); OSXAdapter.setQuitHandler(this, osxQuit); } catch (NoSuchMethodException e) { throw new RuntimeException(e); } } }
From source file:org.carrot2.workbench.vis.aduna.AdunaClusterMapViewPage.java
private void createAdunaControl(Composite parent) { /*// w w w . j ava2 s . c o m * If <code>true</code>, try some dirty hacks to avoid flicker on Windows. */ final boolean windowsFlickerHack = true; if (windowsFlickerHack) { System.setProperty("sun.awt.noerasebackground", "true"); } this.scrollable = new Composite(parent, SWT.H_SCROLL | SWT.V_SCROLL); scrollable.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); final GridLayout layout = new GridLayout(); layout.marginBottom = 0; layout.marginLeft = 0; layout.marginRight = 0; layout.marginTop = 0; layout.horizontalSpacing = 0; layout.verticalSpacing = 0; layout.marginHeight = 0; layout.marginWidth = 0; scrollable.setLayout(layout); embedded = new Composite(scrollable, SWT.NO_BACKGROUND | SWT.EMBEDDED); embedded.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); final Frame frame = SWT_AWT.new_Frame(embedded); frame.setLayout(new java.awt.BorderLayout()); // LINGO-446: flicker fix; see "Creating a Root Pane Container" in http://www.eclipse.org/articles/article.php?file=Article-Swing-SWT-Integration/index.html final JApplet applet = new JApplet(); frame.add(applet); applet.setLayout(new java.awt.BorderLayout()); final JScrollPane scrollPanel = new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_NEVER, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); scrollPanel.setDoubleBuffered(true); scrollPanel.setBorder(BorderFactory.createEmptyBorder()); applet.getContentPane().add(scrollPanel, java.awt.BorderLayout.CENTER); final ClusterMapFactory factory = ClusterMapFactory.createFactory(); final ClusterMap clusterMap = factory.createClusterMap(); final ClusterMapMediator mapMediator = factory.createMediator(clusterMap); this.mapMediator = mapMediator; final ClusterGraphPanel graphPanel = mapMediator.getGraphPanel(); graphPanel.setDoubleBuffered(true); scrollPanel.setViewportView(graphPanel); scrollable.addControlListener(new ControlAdapter() { @Override public void controlResized(ControlEvent e) { updateScrollBars(); } }); final SelectionAdapter adapter = new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { ScrollBar hbar = scrollable.getHorizontalBar(); ScrollBar vbar = scrollable.getVerticalBar(); final java.awt.Rectangle viewport = new java.awt.Rectangle(hbar.getSelection(), vbar.getSelection(), hbar.getThumb(), vbar.getThumb()); SwingUtilities.invokeLater(new Runnable() { public void run() { graphPanel.scrollRectToVisible(viewport); } }); } }; scrollable.getVerticalBar().addSelectionListener(adapter); scrollable.getHorizontalBar().addSelectionListener(adapter); final Runnable updateScrollBarsAsync = new Runnable() { public void run() { updateScrollBars(); } }; graphPanel.addComponentListener(new ComponentAdapter() { @Override public void componentShown(ComponentEvent e) { graphPanelSize = graphPanel.getPreferredSize(); Display.getDefault().asyncExec(updateScrollBarsAsync); } @Override public void componentResized(ComponentEvent e) { graphPanelSize = graphPanel.getPreferredSize(); Display.getDefault().asyncExec(updateScrollBarsAsync); } }); }
From source file:org.datanucleus.ide.idea.ui.DNEConfigForm.java
/** * Method generated by IntelliJ IDEA GUI Designer * >>> IMPORTANT!! <<< * DO NOT edit this method OR call it in your code! * * @noinspection ALL//from w w w. j a v a2 s . c o m */ private void $$$setupUI$$$() { createUIComponents(); parentPanel.setLayout(new GridLayoutManager(2, 1, new Insets(1, 0, 0, 0), -1, -1)); configTabbedPane = new JTabbedPane(); parentPanel.add(configTabbedPane, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); configPanel = new JPanel(); configPanel.setLayout(new GridLayoutManager(5, 3, new Insets(6, 2, 2, 2), -1, -1)); configTabbedPane.addTab("Enhancer", configPanel); indexNotReadyPanel = new JPanel(); indexNotReadyPanel.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); configPanel.add(indexNotReadyPanel, new GridConstraints(3, 0, 1, 3, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, 1, null, null, null, 0, false)); final JLabel label1 = new JLabel(); label1.setText("Please wait until indexing is finished"); indexNotReadyPanel.add(label1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); contentPanel = new JPanel(); contentPanel.setLayout(new GridLayoutManager(2, 1, new Insets(0, 0, 0, 0), -1, -1)); configPanel.add(contentPanel, new GridConstraints(4, 0, 1, 3, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); final JPanel panel1 = new JPanel(); panel1.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); contentPanel.add(panel1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); panel1.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(new Color(-3355444)), "Affected Modules")); final JScrollPane scrollPane1 = new JScrollPane(); panel1.add(scrollPane1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); affectedModulesTable = new JTable(); affectedModulesTable.setEnabled(true); affectedModulesTable.setFillsViewportHeight(false); affectedModulesTable.setPreferredScrollableViewportSize(new Dimension(450, 30)); scrollPane1.setViewportView(affectedModulesTable); final JPanel panel2 = new JPanel(); panel2.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); contentPanel.add(panel2, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); panel2.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(new Color(-3355444)), "Metadata and annotated classes for enhancement", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, new Color(-16777216))); infoPanel = new JPanel(); infoPanel.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); panel2.add(infoPanel, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JLabel label2 = new JLabel(); label2.setText("Please click 'Make Project' to see affected files"); infoPanel.add(label2, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); metaDataAndClassesScrollPane = new JScrollPane(); panel2.add(metaDataAndClassesScrollPane, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); metadataAndClassesTable = new JTable(); metadataAndClassesTable.setFillsViewportHeight(false); metadataAndClassesTable.setFont(new Font(metadataAndClassesTable.getFont().getName(), metadataAndClassesTable.getFont().getStyle(), metadataAndClassesTable.getFont().getSize())); metadataAndClassesTable.setPreferredScrollableViewportSize(new Dimension(450, 100)); metaDataAndClassesScrollPane.setViewportView(metadataAndClassesTable); modifiersPanel = new JPanel(); modifiersPanel.setLayout(new GridLayoutManager(2, 3, new Insets(0, 2, 0, 0), -1, -1)); configPanel.add(modifiersPanel, new GridConstraints(1, 0, 2, 3, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JLabel label3 = new JLabel(); label3.setText(" Metadata file extensions (use ';' to separate)"); modifiersPanel.add(label3, new GridConstraints(0, 0, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); includeTestClassesCheckBox = new JCheckBox(); includeTestClassesCheckBox.setText("Include Test classes"); modifiersPanel.add(includeTestClassesCheckBox, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); metadataExtensionTextField.setAlignmentX(0.5f); metadataExtensionTextField.setAutoscrolls(true); metadataExtensionTextField.setMargin(new Insets(1, 1, 1, 1)); modifiersPanel.add(metadataExtensionTextField, new GridConstraints(1, 0, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); addToCompilerResourceCheckBox = new JCheckBox(); addToCompilerResourceCheckBox.setText("Add to compiler resource patterns"); modifiersPanel.add(addToCompilerResourceCheckBox, new GridConstraints(1, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); dependenciesPanel = new JPanel(); dependenciesPanel.setLayout(new GridLayoutManager(3, 1, new Insets(6, 2, 2, 2), -1, -1)); configTabbedPane.addTab("Dependencies", dependenciesPanel); final JPanel panel3 = new JPanel(); panel3.setLayout(new GridLayoutManager(1, 4, new Insets(0, 0, 0, 0), 5, 5)); dependenciesPanel.add(panel3, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, 1, null, null, null, 0, false)); depProjectModuleRadioButton.setText("Project Module Dependencies"); panel3.add(depProjectModuleRadioButton, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); depManualRadioButton.setText("Manual Dependencies"); panel3.add(depManualRadioButton, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final Spacer spacer1 = new Spacer(); panel3.add(spacer1, new GridConstraints(0, 3, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); depManualUnsupportedLabel = new JLabel(); depManualUnsupportedLabel.setText("(Not supported by plugin extension)"); panel3.add(depManualUnsupportedLabel, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); manualDependenciesDisabledInfoPanel.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); dependenciesPanel.add(manualDependenciesDisabledInfoPanel, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JLabel label4 = new JLabel(); label4.setHorizontalAlignment(0); label4.setHorizontalTextPosition(0); label4.setText("Using Enhancer and it's Dependencies from Project Module"); manualDependenciesDisabledInfoPanel.add(label4, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); dependenciesPanel.add(dependenciesAddDeletePanel, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); generalPanel = new JPanel(); generalPanel.setLayout(new GridLayoutManager(1, 3, new Insets(0, 0, 0, 0), -1, -1)); parentPanel.add(generalPanel, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); enableEnhancerCheckBox = new JCheckBox(); enableEnhancerCheckBox.setText("Enable Enhancer"); generalPanel.add(enableEnhancerCheckBox, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JPanel panel4 = new JPanel(); panel4.setLayout(new GridLayoutManager(1, 3, new Insets(0, 0, 0, 0), -1, -1)); generalPanel.add(panel4, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, 1, null, null, null, 0, false)); jDORadioButton.setText("JDO"); panel4.add(jDORadioButton, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); jPARadioButton = new JRadioButton(); jPARadioButton.setText("JPA"); panel4.add(jPARadioButton, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final Spacer spacer2 = new Spacer(); panel4.add(spacer2, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); generalPanel.add(persistenceImplComboBox, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); ButtonGroup buttonGroup; buttonGroup = new ButtonGroup(); buttonGroup.add(jDORadioButton); buttonGroup.add(jPARadioButton); buttonGroup = new ButtonGroup(); buttonGroup.add(depProjectModuleRadioButton); buttonGroup.add(depManualRadioButton); }
From source file:org.datanucleus.ide.idea.ui.v10x.DNEConfigFormV10x.java
/** * Method generated by IntelliJ IDEA GUI Designer * >>> IMPORTANT!! <<< * DO NOT edit this method OR call it in your code! * * @noinspection ALL//from www .ja v a 2 s .c om */ private void $$$setupUI$$$() { createUIComponents(); configPanel = new JPanel(); configPanel.setLayout(new GridLayoutManager(5, 3, new Insets(0, 0, 0, 0), -1, -1)); enableEnhancerCheckBox = new JCheckBox(); enableEnhancerCheckBox.setText("Enable Enhancer"); configPanel.add(enableEnhancerCheckBox, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JPanel panel1 = new JPanel(); panel1.setLayout(new GridLayoutManager(1, 3, new Insets(0, 0, 0, 0), -1, -1)); configPanel.add(panel1, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, 1, null, null, null, 0, false)); jDORadioButton = new JRadioButton(); jDORadioButton.setText("JDO"); panel1.add(jDORadioButton, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); jPARadioButton = new JRadioButton(); jPARadioButton.setText("JPA"); panel1.add(jPARadioButton, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final Spacer spacer1 = new Spacer(); panel1.add(spacer1, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); configPanel.add(persistenceImplComboBox, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JLabel label1 = new JLabel(); label1.setText(" Metadata file extensions (use ';' to separate)"); configPanel.add(label1, new GridConstraints(1, 0, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); includeTestClassesCheckBox = new JCheckBox(); includeTestClassesCheckBox.setText("Include Test classes"); configPanel.add(includeTestClassesCheckBox, new GridConstraints(1, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); metadataExtensionTextField.setAlignmentX(0.5f); metadataExtensionTextField.setAutoscrolls(true); metadataExtensionTextField.setMargin(new Insets(1, 1, 1, 1)); configPanel.add(metadataExtensionTextField, new GridConstraints(2, 0, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); addToCompilerResourceCheckBox = new JCheckBox(); addToCompilerResourceCheckBox.setText("Add to compiler resource patterns"); configPanel.add(addToCompilerResourceCheckBox, new GridConstraints(2, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); indexNotReadyPanel = new JPanel(); indexNotReadyPanel.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); configPanel.add(indexNotReadyPanel, new GridConstraints(3, 0, 1, 3, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JLabel label2 = new JLabel(); label2.setText("Please wait until indexing is finished"); indexNotReadyPanel.add(label2, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); contentPanel = new JPanel(); contentPanel.setLayout(new GridLayoutManager(2, 1, new Insets(0, 0, 0, 0), -1, -1)); configPanel.add(contentPanel, new GridConstraints(4, 0, 1, 3, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JPanel panel2 = new JPanel(); panel2.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); contentPanel.add(panel2, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); panel2.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Affected Modules")); final JScrollPane scrollPane1 = new JScrollPane(); panel2.add(scrollPane1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); affectedModulesTable = new JTable(); affectedModulesTable.setEnabled(true); affectedModulesTable.setFillsViewportHeight(false); affectedModulesTable.setPreferredScrollableViewportSize(new Dimension(450, 30)); scrollPane1.setViewportView(affectedModulesTable); final JPanel panel3 = new JPanel(); panel3.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); contentPanel.add(panel3, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); panel3.setBorder(BorderFactory.createTitledBorder("Metadata and annotated classes for enhancement")); infoPanel = new JPanel(); infoPanel.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); panel3.add(infoPanel, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); final JLabel label3 = new JLabel(); label3.setText("Please click 'Make Project' to see affected files"); infoPanel.add(label3, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); metaDataAndClassesScrollPane = new JScrollPane(); panel3.add(metaDataAndClassesScrollPane, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); metadataAndClassesTable = new JTable(); metadataAndClassesTable.setFillsViewportHeight(false); metadataAndClassesTable.setFont(new Font(metadataAndClassesTable.getFont().getName(), metadataAndClassesTable.getFont().getStyle(), metadataAndClassesTable.getFont().getSize())); metadataAndClassesTable.setPreferredScrollableViewportSize(new Dimension(450, 100)); metaDataAndClassesScrollPane.setViewportView(metadataAndClassesTable); ButtonGroup buttonGroup; buttonGroup = new ButtonGroup(); buttonGroup.add(jDORadioButton); buttonGroup.add(jPARadioButton); }
From source file:org.fhaes.gui.ShapeFileDialog.java
@SuppressWarnings("unchecked") private void initGUI() { setBounds(100, 100, 582, 333);// w w w. j a v a2 s . c om getContentPane().setLayout(new BorderLayout()); contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); getContentPane().add(contentPanel, BorderLayout.CENTER); contentPanel.setLayout(new MigLayout("", "[right][grow]", "[][][][grow]")); { JLabel lblOutputFilename = new JLabel("Output filename:"); contentPanel.add(lblOutputFilename, "cell 0 0,alignx trailing"); } { txtFilename = new JTextField(); txtFilename.getDocument().addDocumentListener(this); contentPanel.add(txtFilename, "flowx,cell 1 0,growx"); txtFilename.setColumns(10); } { JButton btnBrowse = new JButton("Browse"); btnBrowse.setActionCommand("Browse"); btnBrowse.addActionListener(this); contentPanel.add(btnBrowse, "cell 1 0"); } { JLabel lblAttributeTableStyle = new JLabel("Attribute table style:"); contentPanel.add(lblAttributeTableStyle, "cell 0 1,alignx trailing"); } { radStyle1 = new JRadioButton("One marker per site with multiple year attributes"); radStyle1.setActionCommand("Style1"); radStyle1.addActionListener(this); // radStyle1.setSelected(true); buttonGroup.add(radStyle1); contentPanel.add(radStyle1, "cell 1 1"); } { radStyle2 = new JRadioButton("Multiple markers per site, one for each year"); radStyle2.setActionCommand("Style2"); radStyle2.addActionListener(this); buttonGroup.add(radStyle2); new RadioButtonWrapper(buttonGroup, PrefKey.SHAPEFILE_OUTPUT_STYLE, "Style1"); contentPanel.add(radStyle2, "cell 1 2"); } { JPanel panel = new JPanel(); contentPanel.add(panel, "cell 0 3,alignx right,growy"); panel.setLayout(new MigLayout("insets n n n 0", "[119px]", "[15px]")); { JLabel lblYearsToInclude = new JLabel("Years to include:"); panel.add(lblYearsToInclude, "cell 0 0,alignx left,aligny top"); } } { JPanel panel = new JPanel(); contentPanel.add(panel, "cell 1 3,alignx left,growy"); panel.setLayout(new MigLayout("", "[160px:160px][][160px:160px]", "[][grow]")); { JLabel lblAvailableYears = new JLabel("Available:"); panel.add(lblAvailableYears, "cell 0 0,alignx center"); } { lblSelectedYears = new JLabel("Selected:"); panel.add(lblSelectedYears, "cell 2 0,alignx center"); } { JScrollPane scrollPane = new JScrollPane(); panel.add(scrollPane, "cell 0 1,grow"); { lstAvailableYears = new JList(); lstAvailableYears.setModel(availableYearsModel); scrollPane.setViewportView(lstAvailableYears); } } { JButton btnRemove = new JButton("<"); btnRemove.setActionCommand("removeYear"); btnRemove.addActionListener(this); { JButton btnAdd = new JButton(">"); btnAdd.setActionCommand("addYear"); btnAdd.addActionListener(this); panel.add(btnAdd, "flowy,cell 1 1"); } panel.add(btnRemove, "cell 1 1"); } { JScrollPane scrollPane = new JScrollPane(); panel.add(scrollPane, "cell 2 1,grow"); { lstSelectedYears = new JList(); lstSelectedYears.setModel(selectedYearsModel); selectedYearsModel.addListDataListener(new ListDataListener() { @Override public void contentsChanged(ListDataEvent arg0) { pingLayout(); } @Override public void intervalAdded(ListDataEvent arg0) { pingLayout(); } @Override public void intervalRemoved(ListDataEvent arg0) { pingLayout(); } }); scrollPane.setViewportView(lstSelectedYears); } } } { JPanel buttonPane = new JPanel(); buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); getContentPane().add(buttonPane, BorderLayout.SOUTH); { btnOK = new JButton("OK"); btnOK.setActionCommand("OK"); btnOK.addActionListener(this); buttonPane.add(btnOK); getRootPane().setDefaultButton(btnOK); btnOK.setEnabled(false); } { JButton btnCancel = new JButton("Cancel"); btnCancel.setActionCommand("Cancel"); btnCancel.addActionListener(this); buttonPane.add(btnCancel); } } this.setLocationRelativeTo(parent); this.setIconImage(Builder.getApplicationIcon()); this.setTitle("Generate shapefile"); pingLayout(); }
From source file:org.fit.cssbox.scriptbox.demo.tester.JavaScriptTesterUIPresenter.java
private JEditorPane addSourceCodeTab() { JScrollPane sourceCodeScrollPane = new JScrollPane(); NEW_COUNTER++;/*from ww w . j a v a 2 s. c o m*/ sourceCodeTabbedPane.addTab("New " + NEW_COUNTER, null, sourceCodeScrollPane, null); sourceCodeTabbedPane.setSelectedIndex(sourceCodeTabbedPane.getTabCount() - 1); DefaultSyntaxKit.initKit(); final JEditorPane codeEditor = new JEditorPane(); sourceCodeScrollPane.setViewportView(codeEditor); codeEditor.setContentType("text/xhtml"); return codeEditor; }
From source file:org.genedb.jogra.plugins.TermRationaliser.java
private Box createRationaliserPanel(final String name, final RationaliserJList rjlist) { int preferredHeight = 500; //change accordingly int preferredWidth = 500; Toolkit tk = Toolkit.getDefaultToolkit(); Dimension size = tk.getScreenSize(); int textboxHeight = 10; //change accordingly int textboxWidth = size.width; Box box = Box.createVerticalBox(); box.add(new JLabel(name)); JTextField searchField = new JTextField(20); //Search field on top /* We don't want this textfield's height to expand when * the Rationaliser is dragged to exapnd. So we set it's * height to what we want and the width to the width of * the screen // w w w . j a va 2s . c o m */ searchField.setMaximumSize(new Dimension(textboxWidth, textboxHeight)); rjlist.installJTextField(searchField); box.add(searchField); JScrollPane scrollPane = new JScrollPane(); //scroll pane scrollPane.setViewportView(rjlist); scrollPane.setPreferredSize(new Dimension(preferredWidth, preferredHeight)); box.add(scrollPane); TitledBorder sysidBorder = BorderFactory.createTitledBorder("Systematic IDs"); //systematic ID box sysidBorder.setTitleColor(Color.DARK_GRAY); final JTextArea idField = new JTextArea(1, 1); idField.setMaximumSize(new Dimension(textboxWidth, textboxHeight)); idField.setEditable(false); idField.setBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY)); idField.setForeground(Color.DARK_GRAY); JScrollPane scroll = new JScrollPane(idField); scroll.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); Box sysidBox = Box.createVerticalBox(); sysidBox.add(scroll /*idField*/); sysidBox.setBorder(sysidBorder); box.add(sysidBox); rjlist.addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { Term highlightedTerm = (Term) rjlist.getSelectedValue(); if (highlightedTerm != null) { /* For each list, call the relevant methods * to get the systematic IDs. Then for the * right list, add the term name in the * text box below */ if (name.equals(FROM_LIST_NAME)) { idField.setText(StringUtils.collectionToCommaDelimitedString( termService.getSystematicIDs(highlightedTerm, selectedTaxons))); } else if (name.equals(TO_LIST_NAME)) { idField.setText(StringUtils.collectionToCommaDelimitedString( termService.getSystematicIDs(highlightedTerm, null))); /* We allow the user to edit the term name */ textField.setText(highlightedTerm.getName()); } } } }); return box; }
From source file:org.jets3t.gui.skins.SkinsFactory.java
/** * @param itemName//from w w w. j a v a 2s .c o m * the name of this specific item in the GUI, which may be used to determine how the skinned * item should look or behave. * * @param view * the client's viewport view to be used. * * @return * a <code>SkinnedJScrollPane</code> class implementation for the current skin, or a default * JScrollPane if no skin-specific implementation is available. */ public JScrollPane createSkinnedJScrollPane(String itemName, Object view) { Object instance = instantiateClass(buildSkinnedClassName("SkinnedJScrollPane"), itemName); if (instance != null) { JScrollPane scrollPane = (JScrollPane) instance; scrollPane.setViewportView((Component) view); return scrollPane; } else { return new JScrollPane((Component) view); } }