Java Code Examples for javax.swing.JScrollPane
The following code examples are extracted from open source projects. You can click to
vote up the examples that are useful to you.
Example 1
From project addis, under directory /application/src/main/java/org/drugis/addis/gui/.
Source file: AuxComponentFactory.java

public static JScrollPane createInScrollPane(PanelBuilder builder,Dimension prefSize){ JScrollPane scroll=new JScrollPane(builder.getPanel()); scroll.setPreferredSize(prefSize); scroll.getVerticalScrollBar().setUnitIncrement(16); return scroll; }
Example 2
From project Android-DB-Editor, under directory /src/com/troido/dbeditor/.
Source file: AndroidDBEditor.java

public AndroidDBEditor(){ super("Android DB Editor"); this.setVisible(true); List<String> deviceNames=ADBConnector.devices(); for ( String deviceName : deviceNames) { Device d=new Device(deviceName); devices.add(d); } tree=createDeviceTree(devices); JScrollPane scrollPane=new JScrollPane(tree); this.getContentPane().add(scrollPane); this.setSize(300,600); }
Example 3
From project BMach, under directory /src/jsyntaxpane/components/.
Source file: LineNumbersRuler.java

@Override public void deinstall(JEditorPane editor){ removeMouseListener(mouseListener); status=Status.DEINSTALLING; this.editor.getDocument().removeDocumentListener(this); editor.removeCaretListener(this); editor.removePropertyChangeListener(this); JScrollPane sp=getScrollPane(editor); if (sp != null) { editor.getDocument().removeDocumentListener(this); sp.setRowHeaderView(null); } }
Example 4
From project Calendar-Application, under directory /com/toedter/calendar/demo/.
Source file: DemoTable.java

public DemoTable(){ super(new GridLayout(1,0)); setName("DemoTable"); JTable table=new JTable(new DemoTableModel()); table.setPreferredScrollableViewportSize(new Dimension(180,32)); table.setDefaultEditor(Date.class,new JDateChooserCellEditor()); JScrollPane scrollPane=new JScrollPane(table); add(scrollPane); }
Example 5
From project Clotho-Core, under directory /ClothoApps/SeqAnalyzer/src/org/clothocad/algorithm/seqanalyzer/sequencing/.
Source file: ABIClassification.java

public static void main(String[] args){ ABIClassification a=new ABIClassification(12); JScrollPane scrollPane=new JScrollPane(a); scrollPane.setPreferredSize(new Dimension(350,170)); JOptionPane.showMessageDialog(null,scrollPane,"" + a.score,JOptionPane.INFORMATION_MESSAGE); }
Example 6
From project codjo-data-process, under directory /codjo-data-process-gui/src/main/java/net/codjo/dataprocess/gui/util/std/.
Source file: AbstractListWindow.java

protected JPanel buildRequestTablePanel(){ JPanel mainPanel=new JPanel(); mainPanel.setLayout(new BorderLayout()); JScrollPane scrollPane=new JScrollPane(); scrollPane.getViewport().add(requestTable,null); mainPanel.add(scrollPane,BorderLayout.CENTER); GuiUtils.addHorizontalScrollBar(requestTable,scrollPane); return mainPanel; }
Example 7
From project codjo-segmentation, under directory /codjo-segmentation-gui/src/main/java/net/codjo/segmentation/gui/editor/.
Source file: ValueListPanel.java

public ValueListPanel(){ list.setName("editor.valueList"); this.setLayout(new BorderLayout()); this.add(new JLabel("List Of Values"),BorderLayout.NORTH); JScrollPane scroll=new JScrollPane(list); this.add(scroll,BorderLayout.CENTER); }
Example 8
From project dawn-isencia, under directory /com.isencia.passerelle.commons/src/main/java/com/isencia/util/swing/components/.
Source file: DynamicTree.java

public DynamicTree(String rootNodeName){ rootNode=new DefaultMutableTreeNode(rootNodeName); treeModel=new DefaultTreeModel(rootNode); treeModel.addTreeModelListener(new MyTreeModelListener()); tree=new JTree(treeModel); tree.setEditable(true); tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); tree.setShowsRootHandles(true); JScrollPane scrollPane=new JScrollPane(tree); setLayout(new GridLayout(1,0)); add(scrollPane); }
Example 9
From project drools-planner, under directory /drools-planner-examples/src/main/java/org/drools/planner/examples/app/.
Source file: DroolsPlannerExamplesApp.java

private Container createContentPane(){ JPanel contentPane=new JPanel(new BorderLayout(10,10)); contentPane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5)); JLabel titleLabel=new JLabel("Which example do you want to see?",JLabel.CENTER); titleLabel.setFont(titleLabel.getFont().deriveFont(20.0f)); contentPane.add(titleLabel,BorderLayout.NORTH); JScrollPane examplesScrollPane=new JScrollPane(createExamplesPanel()); examplesScrollPane.getHorizontalScrollBar().setUnitIncrement(20); examplesScrollPane.getVerticalScrollBar().setUnitIncrement(20); contentPane.add(examplesScrollPane,BorderLayout.CENTER); contentPane.add(createDescriptionPanel(),BorderLayout.SOUTH); return contentPane; }
Example 10
From project droolsjbpm-integration, under directory /droolsjbpm-integration-examples/src/main/java/org/drools/examples/broker/ui/.
Source file: LogPanel.java

public LogPanel(){ setLayout(new BorderLayout()); log=new JTextArea(); log.setEditable(false); JScrollPane areaScrollPane=new JScrollPane(log); areaScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); add(areaScrollPane,BorderLayout.CENTER); setBorder(BorderFactory.createEmptyBorder(10,10,10,10)); setPreferredSize(new Dimension(400,50)); }
Example 11
From project drugis-common, under directory /common-gui/src/main/java/org/drugis/common/gui/.
Source file: TextComponentFactory.java

public static JScrollPane createTextArea(ValueModel model,boolean editable,boolean commitOnFocusLost){ JTextArea area=BasicComponentFactory.createTextArea(model,commitOnFocusLost); dontStealTabKey(area); area.setEditable(editable); area.setLineWrap(true); area.setWrapStyleWord(true); if (!editable) { area.setUI(new javax.swing.plaf.basic.BasicTextAreaUI()); } JScrollPane pane=new JScrollPane(area); pane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); pane.setPreferredSize(new Dimension(DefaultUnitConverter.getInstance().dialogUnitXAsPixel(200,area),DefaultUnitConverter.getInstance().dialogUnitYAsPixel(50,area))); return pane; }
Example 12
From project encog-java-workbench, under directory /src/main/java/org/encog/workbench/frames/document/tree/.
Source file: ProjectTree.java

public ProjectTree(EncogDocumentFrame doc){ this.doc=doc; this.collectionModel=new EncogCollectionModel(); this.tree=new JTree(this.collectionModel); this.tree.addMouseListener(this); this.tree.addKeyListener(this); this.tree.setCellRenderer(new ProjectTreeRenderer()); final JScrollPane scrollPane=new JScrollPane(this.tree); this.setLayout(new BorderLayout()); this.add(scrollPane,BorderLayout.CENTER); this.tree.updateUI(); dt=new DropTarget(this,this); }
Example 13
From project GenericKnimeNodes, under directory /com.genericworkflownodes.knime.base_plugin/src/com/genericworkflownodes/knime/generic_node/.
Source file: GenericKnimeNodeView.java

private JScrollPane createScrollableOutputArea(final String content){ JTextArea text=new JTextArea(content,40,80); text.setFont(new Font("Monospaced",Font.BOLD,12)); text.setEditable(false); if (content.length() == 0) { text.setEnabled(false); } JScrollPane scrollpane=new JScrollPane(text); return scrollpane; }
Example 14
From project gs-tool, under directory /src/org/graphstream/tool/gui/.
Source file: EnumComboBox.java

Choices(){ JScrollPane scroll=new JScrollPane(); scroll.setPreferredSize(new Dimension(EnumComboBox.this.getWidth(),200)); scroll.setOpaque(false); scroll.getViewport().setOpaque(false); scroll.setBorder(null); setBackground(background); scroll.addFocusListener(this); add(scroll); }
Example 15
/** * @param args * @throws Exception */ public static void main(String[] args) throws Exception { new LogInitiator().init(); Node node=new Node(); if (args[0].equals("joiner1")) { node.init("127.0.0.2","127.0.0.1"); node.sendJoin(args[1]); } else if (args[0].equals("joiner2")) { node.init("127.0.0.3","127.0.0.1"); node.sendJoin(args[1]); } else { node.init("127.0.0.1",null); node.sendJoin(args[1]); } node.gameFrame.addWindowListener(new WindowAdapter(){ public void windowClosing( WindowEvent e){ System.exit(0); } } ); JScrollPane jscrollPane=new JScrollPane(new MainPanel(node)); jscrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); node.gameFrame.getContentPane().add(jscrollPane); node.gameFrame.pack(); node.gameFrame.setVisible(true); }
Example 16
private void init(){ this.setLayout(new GridBagLayout()); JPanel screenP=initScreen(); JScrollPane commentary=initCommentary(); statusBar=new ILabel("EMPTYSTR"); initDS(); GridBagConstraints cs=new GridBagConstraints(); cs.gridx=0; cs.gridy=0; cs.fill=GridBagConstraints.BOTH; add(screenP,cs); GridBagConstraints cc=new GridBagConstraints(); cc.gridx=1; cc.gridy=0; cc.gridheight=2; cc.fill=GridBagConstraints.VERTICAL; add(commentary,cc); GridBagConstraints cb=new GridBagConstraints(); cb.gridx=0; cb.gridy=1; cb.fill=GridBagConstraints.HORIZONTAL; add(B,cb); GridBagConstraints csb=new GridBagConstraints(); csb.gridx=0; csb.gridy=2; csb.fill=GridBagConstraints.HORIZONTAL; add(statusBar,csb); screen.setDS(D); screen.start(); languageChanged(); B.I.requestFocusInWindow(); }
Example 17
From project autopsy, under directory /Core/src/org/sleuthkit/autopsy/filesearch/.
Source file: FileSearchTopComponent.java

/** * This method is called from within the constructor to initialize the form. */ private void initComponents(){ this.setLayout(new BorderLayout()); JPanel filterPanel=new JPanel(); filterPanel.setLayout(new BoxLayout(filterPanel,BoxLayout.Y_AXIS)); filterPanel.setBorder(new EmptyBorder(10,10,10,10)); JScrollPane scrollPane=new JScrollPane(filterPanel); scrollPane.setPreferredSize(this.getSize()); this.add(scrollPane,BorderLayout.CENTER); JLabel label=new JLabel("Search for files that match the following criteria:"); label.setAlignmentX(Component.LEFT_ALIGNMENT); label.setBorder(new EmptyBorder(0,0,10,0)); filterPanel.add(label); this.filterAreas.add(new FilterArea("Name",new NameSearchFilter())); List<FileSearchFilter> metadataFilters=new ArrayList<FileSearchFilter>(); metadataFilters.add(new SizeSearchFilter()); metadataFilters.add(new DateSearchFilter()); this.filterAreas.add(new FilterArea("Metadata",metadataFilters)); this.filterAreas.add(new FilterArea("Known Status",new KnownStatusSearchFilter())); for ( FilterArea fa : this.filterAreas) { fa.setMaximumSize(new Dimension(Integer.MAX_VALUE,fa.getMinimumSize().height)); fa.setAlignmentX(Component.LEFT_ALIGNMENT); filterPanel.add(fa); } this.searchButton=new JButton("Search"); this.searchButton.setAlignmentX(Component.LEFT_ALIGNMENT); this.searchButton.addActionListener(new ActionListener(){ @Override public void actionPerformed( ActionEvent e){ FileSearchTopComponent.this.search(); } } ); filterPanel.add(searchButton); }
Example 18
From project Briss, under directory /src/main/java/at/laborg/briss/gui/.
Source file: HelpDialog.java

public HelpDialog(Frame owner,String title,Dialog.ModalityType modalityType){ super(owner,title,modalityType); setBounds(232,232,500,800); String helpText=""; InputStream is=getClass().getResourceAsStream(HELP_FILE_PATH); byte[] buf=new byte[1024 * 100]; try { int cnt=is.read(buf); helpText=new String(buf,0,cnt); } catch ( IOException e) { helpText="Couldn't read the help file... Please contact gerhard.aigner@gmail.com"; } JEditorPane jEditorPane=new JEditorPane("text/html",helpText); jEditorPane.setEditable(false); jEditorPane.setVisible(true); JScrollPane scroller=new JScrollPane(jEditorPane); getContentPane().add(scroller); setDefaultCloseOperation(DISPOSE_ON_CLOSE); setVisible(true); }
Example 19
From project ceres, under directory /ceres-jai/src/test/java/com/bc/ceres/jai/.
Source file: DFTTestMain.java

public static void showImage(RenderedImage image,String name){ int width=image.getWidth(); int height=image.getHeight(); int numBands=image.getSampleModel().getNumBands(); int dataType=image.getSampleModel().getDataType(); System.out.println("============= Image " + name); System.out.println("width = " + width); System.out.println("height = " + height); System.out.println("numBands = " + numBands); System.out.println("dataType = " + dataType); BufferedImage bufferedImage; if (image instanceof PlanarImage) { PlanarImage planarImage=(PlanarImage)image; long t0=System.nanoTime(); bufferedImage=planarImage.getAsBufferedImage(); long t1=System.nanoTime(); System.out.println("BufferedImage created in " + (t1 - t0) / (1000.0 * 1000.0) + " ms"); } else if (image instanceof BufferedImage) { bufferedImage=(BufferedImage)image; } else { throw new IllegalArgumentException("image"); } JScrollPane scrollPane=new JScrollPane(new JLabel(new ImageIcon(bufferedImage))); scrollPane.setBorder(null); JFrame frame=new JFrame(name); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(scrollPane); frame.pack(); frame.setLocation(location+=24,location+=24); frame.setVisible(true); }
Example 20
/** * Brings up a window with a scrolling text pane that display the help information. */ private void showHelp(){ JDialog dialog=new JDialog(this,resources.getString("dialog.help.title")); final JEditorPane helpText=new JEditorPane(); try { URL url=getClass().getResource("GridWorldHelp.html"); helpText.setPage(url); } catch ( Exception e) { helpText.setText(resources.getString("dialog.help.error")); } helpText.setEditable(false); helpText.addHyperlinkListener(new HyperlinkListener(){ public void hyperlinkUpdate( HyperlinkEvent ev){ if (ev.getEventType() == HyperlinkEvent.EventType.ACTIVATED) try { helpText.setPage(ev.getURL()); } catch ( Exception ex) { } } } ); JScrollPane sp=new JScrollPane(helpText); sp.setPreferredSize(new Dimension(650,500)); dialog.getContentPane().add(sp); dialog.setLocation(getX() + getWidth() - 200,getY() + 50); dialog.pack(); dialog.setVisible(true); }
Example 21
From project codjo-broadcast, under directory /codjo-broadcast-gui/src/main/java/net/codjo/broadcast/gui/.
Source file: BroadcastFilesWindow.java

private void jbInit() throws Exception { TitledBorder filesTitledBorder=new TitledBorder(BorderFactory.createEtchedBorder(Color.white,new Color(134,134,134)),""); JScrollPane filesScrollPane=new JScrollPane(); filesScrollPane.getViewport().add(filesTable,null); filesPanel=new JPanel(); filesPanel.setLayout(new BorderLayout()); filesPanel.setBorder(filesTitledBorder); filesPanel.add(filesScrollPane,BorderLayout.CENTER); filesPanel.add(filesToolBar,BorderLayout.SOUTH); Border sectionsBorder=BorderFactory.createEtchedBorder(Color.white,new Color(134,134,134)); TitledBorder sectionsTitledBorder=new TitledBorder(sectionsBorder,""); JScrollPane sectionsScrollPane=new JScrollPane(); sectionsScrollPane.getViewport().add(contentsTable,null); sectionsPanel=new JPanel(); sectionsPanel.setLayout(new BorderLayout()); sectionsPanel.setBorder(sectionsTitledBorder); sectionsPanel.add(sectionsScrollPane,BorderLayout.CENTER); sectionsPanel.add(contentsToolBar,BorderLayout.SOUTH); JSplitPane splitPane=new JSplitPane(JSplitPane.VERTICAL_SPLIT,true,filesPanel,sectionsPanel); splitPane.setResizeWeight(0.3); splitPane.setDividerLocation(300); getContentPane().setLayout(new BorderLayout()); setClosable(true); setResizable(true); setIconifiable(true); setTitle("Fichiers / Sections"); setPreferredSize(new Dimension(500,500)); getContentPane().add(splitPane,BorderLayout.CENTER); }
Example 22
From project codjo-control, under directory /codjo-control-gui/src/main/java/net/codjo/control/gui/plugin/.
Source file: DefaultQuarantineDetailWindow.java

protected void addBasicField(String label,JComponent comp,String tabName){ if (comp instanceof JTextArea) { ((JTextArea)comp).setLineWrap(true); ((JTextArea)comp).setWrapStyleWord(true); getCurrentPanel(tabName).addItem(label,new JScrollPane(comp,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER)); } else { getCurrentPanel(tabName).addItem(label,comp); } }
Example 23
From project codjo-imports, under directory /codjo-imports-gui/src/main/java/net/codjo/imports/gui/.
Source file: FieldImportDetailWindow.java

protected void addField(String fieldName,JLabel label,JComponent comp){ if (comp instanceof JTextArea) { JTextArea textArea=(JTextArea)comp; textArea.setLineWrap(true); textArea.setWrapStyleWord(true); mainPanel.addItem(label,new JScrollPane(textArea,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER)); } else { mainPanel.addItem(label,comp); } dataSource.declare(fieldName,comp); }
Example 24
From project codjo-standalone-common, under directory /src/main/java/net/codjo/gui/.
Source file: ExplorerDataWindow.java

/** * Init GUI. */ private void jbInit(){ final JTree tree=explorer.getTree(); border1=BorderFactory.createEtchedBorder(Color.white,new Color(134,134,134)); titledBorder1=new TitledBorder(border1,"Filtres d'affichage"); tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); tree.putClientProperty("JTree.lineStyle","Angled"); tree.setShowsRootHandles(true); ToolTipManager.sharedInstance().registerComponent(tree); setFrameIcon(UIManager.getIcon("DataExplorer.open")); this.setPreferredSize(new Dimension(325,600)); this.getContentPane().setBackground(Color.lightGray); this.getContentPane().setLayout(borderLayout2); MouseListener ml=new java.awt.event.MouseAdapter(){ /** * Determine la table s?ectionn? par un double click. * @param evt Evenement de la souris. */ public void mousePressed( MouseEvent evt){ DefaultMutableTreeNode nodeInfo=(DefaultMutableTreeNode)tree.getLastSelectedPathComponent(); int selRow=tree.getRowForLocation(evt.getX(),evt.getY()); if (selRow != -1) { if (evt.getClickCount() == 2) { Table table=(Table)nodeInfo.getUserObject(); execute(table); } } } } ; tree.addMouseListener(ml); filterPanel.setBorder(titledBorder1); explorerPanel.setLayout(borderLayout1); JScrollPane treeView=new JScrollPane(tree); this.getContentPane().add(explorerPanel,BorderLayout.CENTER); explorerPanel.add(treeView,BorderLayout.CENTER); this.getContentPane().add(filterPanel,BorderLayout.NORTH); }
Example 25
/** * This method creates a JPanel and add's the TextArea and a userlist to it. * @return tmpPanel The created Panel with the TextArea and the list of users */ private JPanel initMainPanel(){ GridBagConstraints gbc=new GridBagConstraints(); GridBagLayout gbl=new GridBagLayout(); JPanel tmpPanel=new JPanel(gbl); gbc.fill=GridBagConstraints.BOTH; JScrollPane scrollText=new JScrollPane(m_text); gbc.gridx=0; gbc.gridy=0; gbc.gridwidth=1; gbc.gridheight=1; gbc.weightx=3; gbc.weighty=1; gbl.setConstraints(scrollText,gbc); tmpPanel.add(scrollText); JScrollPane scrollClientList=new JScrollPane(m_userlist); gbc.gridx=3; gbc.gridy=0; gbl.setConstraints(scrollClientList,gbc); tmpPanel.add(scrollClientList); m_document.addUndoableEditListener(m_undoManager); return tmpPanel; }
Example 26
From project datavalve, under directory /samples/swingDemo/src/main/java/org/fluttercode/datavalve/samples/swingdemo/.
Source file: Main.java

protected void initForm(){ DataInitializer di=new DataInitializer(); di.init(); table=new JTable(); pane=new JScrollPane(table); table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); getContentPane().add(pane); final ProviderTableModel<Person> model=initModel(di.getSession()); model.addColumn("ID"); model.addColumn("Name"); model.addColumn("Phone"); table.setModel(model); initClickableColumns(model); }
Example 27
From project dawn-common, under directory /org.dawb.hdf5/src/ncsa/hdf/view/.
Source file: DefaultTextView.java

public TextAreaEditor(KeyListener keyListener){ super(new JTextField()); final JTextArea textArea=new JTextArea(); textArea.addKeyListener(keyListener); textArea.setWrapStyleWord(true); textArea.setLineWrap(true); JScrollPane scrollPane=new JScrollPane(textArea); scrollPane.setBorder(null); editorComponent=scrollPane; delegate=new DefaultCellEditor.EditorDelegate(){ private static final long serialVersionUID=7662356579385373160L; @Override public void setValue( Object value){ textArea.setText((value != null) ? value.toString() : ""); } @Override public Object getCellEditorValue(){ return textArea.getText(); } } ; }
Example 28
From project des, under directory /daemon/lib/apache-log4j-1.2.16/contribs/CekiGulcu/.
Source file: AppenderTable.java

static public void main(String[] args){ if (args.length != 2) { System.err.println("Usage: java AppenderTable bufferSize runLength\n" + " where bufferSize is the size of the cyclic buffer in the TableModel\n" + " and runLength is the total number of elements to add to the table in\n"+ " this test run."); return; } JFrame frame=new JFrame("JTableAppennder test"); Container container=frame.getContentPane(); AppenderTable tableAppender=new AppenderTable(); int bufferSize=Integer.parseInt(args[0]); AppenderTableModel model=new AppenderTableModel(bufferSize); tableAppender.setModel(model); int runLength=Integer.parseInt(args[1]); JScrollPane sp=new JScrollPane(tableAppender); sp.setPreferredSize(new Dimension(250,80)); container.setLayout(new BoxLayout(container,BoxLayout.X_AXIS)); container.add(sp); JButton button=new JButton("ADD"); container.add(button); button.addActionListener(new JTableAddAction(tableAppender)); frame.setSize(new Dimension(500,300)); frame.setVisible(true); long before=System.currentTimeMillis(); int i=0; while (i++ < runLength) { LoggingEvent event=new LoggingEvent("x",logger,Level.ERROR,"Message " + i,null); tableAppender.doAppend(event); } long after=System.currentTimeMillis(); long totalTime=(after - before); System.out.println("Total time :" + totalTime + " milliseconds for "+ "runLength insertions."); System.out.println("Average time per insertion :" + (totalTime * 1000 / runLength) + " micro-seconds."); }
Example 29
From project empire-db, under directory /empire-db-examples/empire-db-example-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/server/.
Source file: ServerGUI.java

/** * This method initializes scroller * @return javax.swing.JScrollPane */ private JScrollPane getScroller(){ if (scroller == null) { scroller=new JScrollPane(); scroller.setPreferredSize(new Dimension(500,250)); scroller.setViewportView(getJEditorPane()); } return scroller; }
Example 30
From project extension_libero_manufacturing, under directory /extension/eevolution/libero/src/main/java/org/eevolution/form/.
Source file: CAbstractBOMTree.java

private void jbInit(){ CLabel label=null; if (BOMWrapper.BOM_TYPE_PRODUCT.equals(type())) { label=new CLabel(Msg.translate(Env.getCtx(),MProduct.Table_Name + "_ID")); } else if (BOMWrapper.BOM_TYPE_ORDER.equals(type())) { label=new CLabel(Msg.translate(Env.getCtx(),MPPOrder.Table_Name + "_ID")); } label.setLabelFor(lookup); northPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); northPanel.add(label,null); northPanel.add(lookup,null); southPanel.setLayout(new BorderLayout()); JScrollPane sp=new JScrollPane(nodeDescription); sp.setBorder(null); contentPane.add(sp,JSplitPane.RIGHT); this.setLayout(new BorderLayout()); this.setPreferredSize(new Dimension(1000,600)); this.add(northPanel,BorderLayout.NORTH); this.add(contentPane,BorderLayout.CENTER); this.add(southPanel,BorderLayout.SOUTH); }
Example 31
From project flyingsaucer, under directory /flying-saucer-core/src/main/java/org/xhtmlrenderer/simple/extend/form/.
Source file: TextAreaField.java

public JComponent create(){ int rows=4; int cols=10; if (hasAttribute("rows")) { int parsedRows=GeneralUtil.parseIntRelaxed(getAttribute("rows")); if (parsedRows > 0) { rows=parsedRows; } } if (hasAttribute("cols")) { int parsedCols=GeneralUtil.parseIntRelaxed(getAttribute("cols")); if (parsedCols > 0) { cols=parsedCols; } } _textarea=new TextAreaFieldJTextArea(rows,cols); _textarea.setWrapStyleWord(true); _textarea.setLineWrap(true); JScrollPane scrollpane=new JScrollPane(_textarea); scrollpane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); scrollpane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); applyComponentStyle(_textarea,scrollpane); return scrollpane; }
Example 32
From project formic, under directory /src/java/org/formic/wizard/step/gui/.
Source file: TemplateStep.java

/** * {@inheritDoc} * @see org.formic.wizard.step.GuiStep#init() */ public Component init(){ JPanel panel=new JPanel(); panel.setLayout(new BorderLayout()); if (html != null) { JEditorPane editor=new JEditorPane("text/html",StringUtils.EMPTY); editor.setEditable(false); editor.setOpaque(false); editor.addHyperlinkListener(new HyperlinkListener()); editor.setBorder(null); editor.setFocusable(false); content=editor; } else { JTextArea area=new JTextArea(); area.setEditable(false); content=area; } JScrollPane scroll=new JScrollPane(content); scroll.setBorder(null); panel.add(scroll,BorderLayout.CENTER); return panel; }
Example 33
From project freemind, under directory /freemind/accessories/plugins/.
Source file: AutomaticLayout.java

public void layout(DefaultFormBuilder builder,TextTranslator pTranslator){ JLabel label=builder.append(pTranslator.getText(getLabel())); builder.append(new JLabel()); label.setToolTipText(pTranslator.getText(getDescription())); builder.appendSeparator(); builder.append(new JScrollPane(mList),3); }
Example 34
From project FScape, under directory /src/main/java/de/sciss/fscape/session/.
Source file: DocumentFrame.java

public void actionPerformed(ActionEvent e){ if (threadRunning) return; final List presetNames=getPresets().presetNames(); presetNames.remove(Presets.DEFAULT); final JList list=new JList(presetNames.toArray()); final JScrollPane scroll=new JScrollPane(list); final JOptionPane op=new JOptionPane(scroll,JOptionPane.QUESTION_MESSAGE,JOptionPane.OK_CANCEL_OPTION); final int result=BasicWindowHandler.showDialog(op,getComponent(),app.getResourceString("procWinChooseDelPreset")); if (result == JOptionPane.OK_OPTION) { final Object[] selNames=list.getSelectedValues(); for (int i=0; i < selNames.length; i++) { deletePreset(selNames[i].toString()); } } }
Example 35
From project gitblit, under directory /src/com/gitblit/client/.
Source file: EditRepositoryDialog.java

public void setCustomFields(RepositoryModel repository,Map<String,String> customFields){ customFieldsPanel.removeAll(); customTextfields=new ArrayList<JTextField>(); final Insets insets=new Insets(5,5,5,5); JPanel fields=new JPanel(new GridLayout(0,1,0,5)){ private static final long serialVersionUID=1L; @Override public Insets getInsets(){ return insets; } } ; for ( Map.Entry<String,String> entry : customFields.entrySet()) { String field=entry.getKey(); String value=""; if (repository.customFields != null && repository.customFields.containsKey(field)) { value=repository.customFields.get(field); } JTextField textField=new JTextField(value); textField.setName(field); textField.setPreferredSize(new Dimension(450,26)); fields.add(newFieldPanel(entry.getValue(),250,textField)); customTextfields.add(textField); } JScrollPane jsp=new JScrollPane(fields); jsp.getVerticalScrollBar().setBlockIncrement(100); jsp.getVerticalScrollBar().setUnitIncrement(100); jsp.setViewportBorder(null); customFieldsPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); customFieldsPanel.add(jsp); }
Example 36
/** * Create the frame. */ public LyricsGui(String text){ setTitle("Lyrics"); this.setIconImage(new ImageUtil().getLogo()); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); setBounds(100,100,560,343); contentPane=new JPanel(); contentPane.setBorder(new EmptyBorder(5,5,5,5)); setContentPane(contentPane); JTextArea txtrTexthtml=new JTextArea(); txtrTexthtml.setEditable(false); txtrTexthtml.setLineWrap(true); txtrTexthtml.setRows(8); JScrollPane scrollingResult=new JScrollPane(txtrTexthtml); JLabel lblLyric=new JLabel("Lyric (maybe this can be a wrong lyric, take care!):"); lblLyric.setFont(new Font("Tahoma",Font.BOLD,11)); txtrTexthtml.setText(" " + text.replaceAll("<br />,","\n")); GroupLayout gl_contentPane=new GroupLayout(contentPane); gl_contentPane.setHorizontalGroup(gl_contentPane.createParallelGroup(Alignment.LEADING).addGroup(gl_contentPane.createSequentialGroup().addGap(10).addGroup(gl_contentPane.createParallelGroup(Alignment.TRAILING).addComponent(scrollingResult,Alignment.LEADING).addComponent(lblLyric,Alignment.LEADING,GroupLayout.DEFAULT_SIZE,404,Short.MAX_VALUE)).addGap(10))); gl_contentPane.setVerticalGroup(gl_contentPane.createParallelGroup(Alignment.LEADING).addGroup(gl_contentPane.createSequentialGroup().addGap(11).addComponent(lblLyric).addPreferredGap(ComponentPlacement.RELATED).addComponent(scrollingResult,GroupLayout.DEFAULT_SIZE,224,Short.MAX_VALUE))); contentPane.setLayout(gl_contentPane); }
Example 37
From project harmony, under directory /phosphorus-gmpls/src/main/java/org/opennaas/extensions/gmpls/client/views/.
Source file: GmplsCreatePathPanel.java

/** * This method initializes scrollSource. * @return javax.swing.JScrollPane */ private JScrollPane getScrollSource(){ if (this.scrollSource == null) { this.scrollSource=new JScrollPane(); this.scrollSource.setViewportView(this.getTblSource()); } return this.scrollSource; }
Example 38
public DynamicTree(String s,boolean allowMultipleSelection){ super(new GridLayout(1,0)); rootNode=new DefaultMutableTreeNode(s); treeModel=new DefaultTreeModel(rootNode); treeModel.addTreeModelListener(new MyTreeModelListener()); tree=new JTree(treeModel); tree.setCellRenderer(new IconNodeRenderer()); tree.setEditable(false); tree.setRequestFocusEnabled(false); if (allowMultipleSelection == false) tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); else if (allowMultipleSelection == true) tree.getSelectionModel().setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION); tree.setShowsRootHandles(true); tree.setDragEnabled(true); tree.setFocusable(true); JScrollPane scrollPane=new JScrollPane(tree); scrollPane.setBorder(BorderFactory.createLoweredBevelBorder()); add(scrollPane); }
Example 39
From project Hotel-Management_MINF10-HCM, under directory /HotelManagement/src/main/java/core/formcontroller/.
Source file: MDIDesktopManager.java

public void setNormalSize(){ JScrollPane scrollPane=getScrollPane(); int x=0; int y=0; Insets scrollInsets=getScrollPaneInsets(); if (scrollPane != null) { Dimension d=scrollPane.getVisibleRect().getSize(); if (scrollPane.getBorder() != null) { d.setSize(d.getWidth() - scrollInsets.left - scrollInsets.right,d.getHeight() - scrollInsets.top - scrollInsets.bottom); } d.setSize(d.getWidth() - 20,d.getHeight() - 20); desktop.setAllSize(x,y); scrollPane.invalidate(); scrollPane.validate(); } }
Example 40
From project hudsontrayapp-plugin, under directory /client-common/src/main/java/org/hudson/trayapp/gui/.
Source file: LatestResultsPanel.java

/** * This method initializes resultsTableScrollPane * @return javax.swing.JScrollPane */ private JScrollPane getResultsTableScrollPane(){ if (resultsTableScrollPane == null) { resultsTableScrollPane=new JScrollPane(); resultsTableScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); resultsTableScrollPane.setViewportView(getResultsTablePanel()); } return resultsTableScrollPane; }
Example 41
From project ib-ruby, under directory /misc/IBJts-965/java/TestJavaClient/.
Source file: AccountDlg.java

public AccountDlg(JFrame parent){ super(parent,true); JScrollPane acctPane=new JScrollPane(new JTable(m_acctValueModel)); JScrollPane portPane=new JScrollPane(new JTable(m_portfolioModel)); acctPane.setBorder(BorderFactory.createTitledBorder("Key, Value, Currency, and Account")); portPane.setBorder(BorderFactory.createTitledBorder("Portfolio Entries")); JSplitPane splitPane=new JSplitPane(JSplitPane.VERTICAL_SPLIT,acctPane,portPane); splitPane.setOneTouchExpandable(true); splitPane.setDividerLocation(240); splitPane.setPreferredSize(new Dimension(600,350)); JPanel timePanel=new JPanel(); timePanel.add(m_timeLabel); timePanel.add(m_updateTime); timePanel.add(m_close); m_updateTime.setEditable(false); m_updateTime.setHorizontalAlignment(JTextField.CENTER); m_updateTime.setPreferredSize(new Dimension(80,26)); m_close.addActionListener(new ActionListener(){ public void actionPerformed( ActionEvent e){ onClose(); } } ); getContentPane().add(splitPane,BorderLayout.CENTER); getContentPane().add(timePanel,BorderLayout.SOUTH); setLocation(20,20); pack(); reset(); }
Example 42
From project beanmill_1, under directory /src/main/java/com/traxel/lumbermill/event/.
Source file: EventsPanel.java

/** * Creates a new EventsPanel object. * @param tableView DOCUMENT ME! * @param eventView DOCUMENT ME! */ public EventsPanel(final TableView tableView,final EventView eventView){ super(VERTICAL_SPLIT); this.tableView=tableView; this.eventView=eventView; tableScroll=new JScrollPane(tableView); tableScroll.setBorder(new EmptyBorder(1,1,1,1)); eventScroll=new JScrollPane(); eventScroll.setBorder(new EmptyBorder(1,1,1,1)); final EventViewVieport vp=new EventViewVieport(eventView); eventScroll.setViewport(vp); tableScroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); tableScroll.setPreferredSize(new Dimension(600,100)); eventScroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); eventScroll.setPreferredSize(new Dimension(600,300)); setLeftComponent(tableScroll); setRightComponent(eventScroll); setResizeWeight(0.25d); setOneTouchExpandable(true); }
Example 43
From project CBCJVM, under directory /cbc/CBCJVM/src/cbccore/low/.
Source file: CBCSimulator.java

public CBCSimulator(){ try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch ( Exception e) { System.out.println("Error setting native LAF: " + e); } cbob=new SimulatedCBOB(this); sound=new SimulatedSound(this); sensor=new SimulatedSensor(this); device=new SimulatedDevice(this); display=new SimulatedDisplay(this); input=new SimulatedInput(this); servo=new SimulatedServo(this); motor=new SimulatedMotor(this); camera=new SimulatedCamera(this); create=new SimulatedCreate(this); for (int i=0; i < motorSpeedLabels.length; ++i) { motorSpeedLabels[i]=new JLabel(); } if (stdOut == null) { stdOut=System.out; } System.out.println("Welcome to CBCJava"); frame.getContentPane().add(new JScrollPane(display.getTextBox()),BorderLayout.CENTER); System.setOut(display.getPrintStream()); addSidebar(); addMotorLabels(); addButtons(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Dimension screenSize=Toolkit.getDefaultToolkit().getScreenSize(); frame.setSize(Math.min(1024,(int)(screenSize.width * .7)),Math.min(768,(int)(screenSize.height * .7))); frame.setVisible(true); new MotorSpeedUpdater(this,100).start(); }
Example 44
From project Cinch, under directory /example/com/palantir/ptoss/cinch/example/.
Source file: IntroCinchMVC.java

private void initializeInterface(){ JPanel toPanel=new JPanel(new BorderLayout()); toPanel.add(new JLabel("To"),BorderLayout.NORTH); toPanel.add(toField,BorderLayout.CENTER); toPanel.setBorder(BorderFactory.createEmptyBorder(0,0,5,0)); JPanel subjectPanel=new JPanel(new BorderLayout()); subjectPanel.add(new JLabel("Subject"),BorderLayout.NORTH); subjectPanel.add(subjectField,BorderLayout.CENTER); subjectPanel.setBorder(BorderFactory.createEmptyBorder(0,0,5,0)); JPanel bodyPanel=new JPanel(new BorderLayout()); bodyPanel.add(new JLabel("Body"),BorderLayout.NORTH); bodyPanel.add(new JScrollPane(bodyArea),BorderLayout.CENTER); bodyPanel.setBorder(BorderFactory.createEmptyBorder(0,0,5,0)); JPanel topPanel=new JPanel(new BorderLayout()); topPanel.add(toPanel,BorderLayout.NORTH); topPanel.add(subjectPanel,BorderLayout.SOUTH); JPanel bottomPanel=new JPanel(new BorderLayout()); bottomPanel.add(messageLabel,BorderLayout.WEST); JPanel buttonPanel=new JPanel(); buttonPanel.add(yellButton); buttonPanel.add(sendButton); bottomPanel.add(buttonPanel,BorderLayout.EAST); bodyArea.setPreferredSize(new Dimension(400,200)); panel.setLayout(new BorderLayout()); panel.add(topPanel,BorderLayout.NORTH); panel.add(bodyPanel,BorderLayout.CENTER); panel.add(bottomPanel,BorderLayout.SOUTH); panel.setBorder(BorderFactory.createEmptyBorder(10,10,10,10)); }
Example 45
From project encog-java-examples, under directory /src/main/java/org/encog/examples/gui/elementary/.
Source file: ElementaryExample.java

public ElementaryExample(){ setSize(500,500); setTitle("Elementary CA"); Container c=getContentPane(); c.setLayout(new BorderLayout()); JPanel buttonPanel=new JPanel(); buttonPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); c.add(buttonPanel,BorderLayout.NORTH); c.add(this.status=new JLabel(),BorderLayout.SOUTH); buttonPanel.add(new JLabel("Rule:")); buttonPanel.add(this.ruleText=new JTextField("110")); buttonPanel.add(new JLabel("Size:")); buttonPanel.add(this.sizeText=new JTextField("500")); buttonPanel.add(generateButton=new JButton("Generate")); this.worldArea=new DisplayPanel(); this.scroll=new JScrollPane(this.worldArea); c.add(this.scroll,BorderLayout.CENTER); generateButton.addActionListener(this); String[] test={"1x","2x","3x","5x","10x"}; this.zoomCombo=new JComboBox(test); buttonPanel.add(new JLabel("Zoom:")); buttonPanel.add(zoomCombo); zoomCombo.addItemListener(this); this.addWindowListener(this); }
Example 46
public UIDemo(){ JPanel leftPanel=new JPanel(new BorderLayout()); leftPanel.add(new JScrollPane(createTreeComponent()),BorderLayout.NORTH); leftPanel.add(new JScrollPane(createTableComponent()),BorderLayout.CENTER); leftPanel.add(new JScrollPane(createListComponent()),BorderLayout.SOUTH); JSplitPane mainSplit=new JSplitPane(); mainSplit.setDividerSize(8); mainSplit.setOneTouchExpandable(true); mainSplit.setContinuousLayout(true); mainSplit.setLeftComponent(leftPanel); JPanel rightPanel=new JPanel(new BorderLayout()); mainSplit.setRightComponent(rightPanel); rightPanel.add(createButtonComponent(),BorderLayout.NORTH); JPanel rightSubPanel=new JPanel(new BorderLayout()); rightPanel.add(rightSubPanel,BorderLayout.CENTER); JPanel rightSubPanel2=new JPanel(new BorderLayout()); rightSubPanel2.add(createInputComponent(),BorderLayout.NORTH); rightSubPanel2.add(createMDIComponent(),BorderLayout.CENTER); JSplitPane rightSplit=new JSplitPane(JSplitPane.VERTICAL_SPLIT); rightSplit.setDividerSize(10); rightSplit.setDividerLocation(400); rightSplit.setOneTouchExpandable(true); rightSplit.setTopComponent(rightSubPanel2); rightSplit.setBottomComponent(createBorderComponent()); rightSubPanel.add(createProgressComponent(),BorderLayout.NORTH); rightSubPanel.add(rightSplit,BorderLayout.CENTER); rightSubPanel.add(createTabComponent(),BorderLayout.SOUTH); setLayout(new BorderLayout()); mainSplit.setDividerLocation(300); add(mainSplit,BorderLayout.CENTER); }
Example 47
public TeamPanel(Team team){ this.team=team; Color color=team.getColor(); double gray=0.2989 * color.getRed() + 0.5870 * color.getGreen() + 0.1140 * color.getBlue(); header.setBackground(gray > 128 ? Color.DARK_GRAY : Color.WHITE); setLayout(new BorderLayout()); header.setBorder(BorderFactory.createEmptyBorder(2,5,2,5)); header.setLayout(new BorderLayout(4,4)); title=new JLabel(team.getName()); title.setForeground(color); title.setFont(getFont().deriveFont(Font.BOLD,14)); title.setBorder(BorderFactory.createEmptyBorder(5,0,5,0)); score.setOpaque(false); score.setForeground(color); score.setFont(getFont().deriveFont(Font.BOLD,14)); score.setBorder(BorderFactory.createEmptyBorder(5,0,5,0)); score.setHorizontalAlignment(JLabel.RIGHT); header.add(title,BorderLayout.CENTER); header.add(score,BorderLayout.EAST); add(header,BorderLayout.NORTH); add(new JScrollPane(clientPanel),BorderLayout.CENTER); team.addListener(this); }