public LayerDesignPanel(MainFrame father) { this.father = father; this.setLayout(null); jsp.setBounds(10, 10, 800, 600); this.add(jsp); jspL.setBounds(820, 10, 140, 200); this.add(jspL); jl.setCellRenderer(new MyCellRenderer()); jbSaveLayer.setBounds(820, 220, 140, 20); this.add(jbSaveLayer); jbSaveLayer.addActionListener(this); jbLoadLayer.setBounds(820, 250, 140, 20); this.add(jbLoadLayer); jbLoadLayer.addActionListener(this); jbCreate.setBounds(820, 280, 140, 20); this.add(jbCreate); jbCreate.addActionListener(this); jbLoadAll.setBounds(820, 310, 140, 20); this.add(jbLoadAll); jbLoadAll.addActionListener(this); jtfCengMing.setBounds(820, 340, 140, 20); this.add(jtfCengMing); }
private void setupCentralPanel() { myCentralPanel.removeAll(); if (myUsagePreviewPanel != null) { Disposer.dispose(myUsagePreviewPanel); myUsagePreviewPanel = null; } JScrollPane pane = ScrollPaneFactory.createScrollPane(myTree); if (UsageViewSettings.getInstance().IS_PREVIEW_USAGES) { Splitter splitter = new Splitter(false, UsageViewSettings.getInstance().PREVIEW_USAGES_SPLITTER_PROPORTIONS); pane.putClientProperty(UIUtil.KEEP_BORDER_SIDES, SideBorder.RIGHT); splitter.setFirstComponent(pane); myUsagePreviewPanel = new UsagePreviewPanel(myProject); myUsagePreviewPanel.setBorder(IdeBorderFactory.createBorder(SideBorder.LEFT)); Disposer.register(this, myUsagePreviewPanel); splitter.setSecondComponent(myUsagePreviewPanel); myCentralPanel.add(splitter, BorderLayout.CENTER); } else { myCentralPanel.add(pane, BorderLayout.CENTER); } myCentralPanel.add(myButtonPanel, BorderLayout.SOUTH); myRootPanel.revalidate(); }
private void buildExternalsPanel() { FormBuilder builder = FormBuilder.create().layout(new FormLayout("fill:pref:grow", "p")); int row = 1; for (ExternalFileEntry efe : externals) { builder.add(efe.getPanel()).xy(1, row); builder.appendRows("2dlu, p"); row += 2; } builder.add(Box.createVerticalGlue()).xy(1, row); builder.appendRows("2dlu, p, 2dlu, p"); builder.add(addExtPan).xy(1, row + 2); builder.add(Box.createVerticalGlue()).xy(1, row + 2); // builder.getPanel().setBorder(BorderFactory.createMatteBorder(1,1,1,1,Color.green)); // externalFilesPanel.setBorder(BorderFactory.createMatteBorder(1,1,1,1,Color.red)); JScrollPane pane = new JScrollPane(builder.getPanel()); pane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); externalFilesPanel.setMinimumSize(new Dimension(400, 400)); externalFilesPanel.setPreferredSize(new Dimension(400, 400)); externalFilesPanel.removeAll(); externalFilesPanel.add(pane, BorderLayout.CENTER); externalFilesPanel.revalidate(); externalFilesPanel.repaint(); }
public void scrollToAttribute(Attribute a) { if (!a.getDescriptor().getConfig().equals(getConfig())) { logger.fine("Cannot scroll to attribute that isn't attached to this type of descriptor"); return; } int rowIndex = getCurrentModel().getRowForDescriptor(a.getDescriptor()); int colIndex = getCurrentModel().getColumnForAttribute(a); JScrollPane scrollPane = (JScrollPane) this.getComponent(0); JViewport viewport = (JViewport) scrollPane.getViewport(); EnhancedTable table = (EnhancedTable) viewport.getView(); // This rectangle is relative to the table where the // northwest corner of cell (0,0) is always (0,0). Rectangle rect = table.getCellRect(rowIndex, colIndex, true); // The location of the viewport relative to the table Point pt = viewport.getViewPosition(); // Translate the cell location so that it is relative // to the view, assuming the northwest corner of the // view is (0,0) rect.setLocation(rect.x - pt.x, rect.y - pt.y); // Scroll the area into view viewport.scrollRectToVisible(rect); }
public SplitPaneDemo() { // Create the list of images and put it in a scroll pane. list = new JList(imageNames); list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); list.setSelectedIndex(0); list.addListSelectionListener(this); JScrollPane listScrollPane = new JScrollPane(list); picture = new JLabel(); picture.setFont(picture.getFont().deriveFont(Font.ITALIC)); picture.setHorizontalAlignment(JLabel.CENTER); JScrollPane pictureScrollPane = new JScrollPane(picture); // Create a split pane with the two scroll panes in it. splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, listScrollPane, pictureScrollPane); splitPane.setOneTouchExpandable(true); splitPane.setDividerLocation(150); // Provide minimum sizes for the two components in the split pane. Dimension minimumSize = new Dimension(100, 50); listScrollPane.setMinimumSize(minimumSize); pictureScrollPane.setMinimumSize(minimumSize); // Provide a preferred size for the split pane. splitPane.setPreferredSize(new Dimension(400, 200)); updateLabel(imageNames[list.getSelectedIndex()]); }
public DiffContentPanel(EditableDiffView master, boolean isFirst) { this.master = master; this.isFirst = isFirst; setLayout(new BorderLayout()); editorPane = new DecoratedEditorPane(this); editorPane.setEditable(false); scrollPane = new JScrollPane(editorPane); add(scrollPane); linesActions = new LineNumbersActionsBar(this, master.isActionsEnabled()); actionsScrollPane = new JScrollPane(linesActions); actionsScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); actionsScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER); actionsScrollPane.setBorder(null); add(actionsScrollPane, isFirst ? BorderLayout.LINE_END : BorderLayout.LINE_START); editorPane.putClientProperty(DiffHighlightsLayerFactory.HIGHLITING_LAYER_ID, this); if (!isFirst) { // disable focus traversal, but permit just the up-cycle on ESC key editorPane.setFocusTraversalKeys( KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, Collections.EMPTY_SET); editorPane.setFocusTraversalKeys( KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, Collections.EMPTY_SET); editorPane.setFocusTraversalKeys( KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS, Collections.singleton(KeyStroke.getAWTKeyStroke(KeyEvent.VK_ESCAPE, 0))); editorPane.putClientProperty("errorStripeOnly", Boolean.TRUE); editorPane.putClientProperty("code-folding-enable", false); } }
public ConsolePanel() { super(new BorderLayout()); text.setFont(StyleContext.getDefaultStyleContext().getFont("SansSerif", Font.PLAIN, 10)); JScrollPane scroller = new JScrollPane(text); scroller.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); add(BorderLayout.CENTER, scroller); }
private void initGUI() { JPanel pCommand = new JPanel(); pResult = new JPanel(); nsSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, pCommand, pResult); pCommand.setLayout(new BorderLayout()); pResult.setLayout(new BorderLayout()); Font fFont = new Font("Dialog", Font.PLAIN, 12); txtCommand = new JTextArea(5, 40); txtCommand.setMargin(new Insets(5, 5, 5, 5)); txtCommand.addKeyListener(this); txtCommandScroll = new JScrollPane(txtCommand); txtResult = new JTextArea(20, 40); txtResult.setMargin(new Insets(5, 5, 5, 5)); txtResultScroll = new JScrollPane(txtResult); txtCommand.setFont(fFont); txtResult.setFont(new Font("Courier", Font.PLAIN, 12)); /* // button replaced by toolbar butExecute = new JButton("Execute"); butExecute.addActionListener(this); pCommand.add(butExecute, BorderLayout.EAST); */ pCommand.add(txtCommandScroll, BorderLayout.CENTER); gResult = new GridSwing(); gResultTable = new JTable(gResult); gScrollPane = new JScrollPane(gResultTable); // getContentPane().setLayout(new BorderLayout()); pResult.add(gScrollPane, BorderLayout.CENTER); // Set up the tree rootNode = new DefaultMutableTreeNode("Connection"); treeModel = new DefaultTreeModel(rootNode); tTree = new JTree(treeModel); tScrollPane = new JScrollPane(tTree); tScrollPane.setPreferredSize(new Dimension(120, 400)); tScrollPane.setMinimumSize(new Dimension(70, 100)); txtCommandScroll.setPreferredSize(new Dimension(360, 100)); txtCommandScroll.setMinimumSize(new Dimension(180, 100)); gScrollPane.setPreferredSize(new Dimension(460, 300)); ewSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, tScrollPane, nsSplitPane); fMain.getContentPane().add(ewSplitPane, BorderLayout.CENTER); doLayout(); fMain.pack(); }
// {{{ BrowserView constructor BrowserView(final VFSBrowser browser) { this.browser = browser; tmpExpanded = new HashSet<String>(); DockableWindowManager dwm = jEdit.getActiveView().getDockableWindowManager(); KeyListener keyListener = dwm.closeListener(VFSBrowser.NAME); parentDirectories = new ParentDirectoryList(); parentDirectories.addKeyListener(keyListener); parentDirectories.setName("parent"); parentDirectories.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION); parentDirectories.setCellRenderer(new ParentDirectoryRenderer()); parentDirectories.setVisibleRowCount(5); parentDirectories.addMouseListener(new ParentMouseHandler()); final JScrollPane parentScroller = new JScrollPane(parentDirectories); parentScroller.setMinimumSize(new Dimension(0, 0)); table = new VFSDirectoryEntryTable(this); table.addMouseListener(new TableMouseHandler()); table.addKeyListener(new TableKeyListener()); table.setName("file"); JScrollPane tableScroller = new JScrollPane(table); tableScroller.setMinimumSize(new Dimension(0, 0)); tableScroller.getViewport().setBackground(table.getBackground()); tableScroller.getViewport().addMouseListener(new TableMouseHandler()); splitPane = new JSplitPane( browser.isHorizontalLayout() ? JSplitPane.HORIZONTAL_SPLIT : JSplitPane.VERTICAL_SPLIT, parentScroller, tableScroller); splitPane.setOneTouchExpandable(true); EventQueue.invokeLater( new Runnable() { public void run() { String prop = browser.isHorizontalLayout() ? "vfs.browser.horizontalSplitter" : "vfs.browser.splitter"; int loc = jEdit.getIntegerProperty(prop, -1); if (loc == -1) loc = parentScroller.getPreferredSize().height; splitPane.setDividerLocation(loc); parentDirectories.ensureIndexIsVisible(parentDirectories.getModel().getSize()); } }); if (browser.isMultipleSelectionEnabled()) table.getSelectionModel().setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); else table.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION); setLayout(new BorderLayout()); add(BorderLayout.CENTER, splitPane); propertiesChanged(); } // }}}
void onUISettingsChanged() { editorPane.repaint(); linesActions.onUISettingsChanged(); actionsScrollPane.revalidate(); actionsScrollPane.repaint(); revalidate(); repaint(); }
/** Gets the GUI component for this pane. */ public JComponent getGUI() { if (cwp == null) { Object object = mWhiteBoard.get("device_definition"); Object ctx_obj = mWhiteBoard.get("context"); if (null != object && object instanceof ConfigDefinition && null != ctx_obj && ctx_obj instanceof ConfigContext) { mConfigContext = (ConfigContext) ctx_obj; ConfigDefinition def = (ConfigDefinition) object; String token = def.getToken(); // Create a temporary list of ConfigDefinitions to pass to factory. java.util.List def_list = new ArrayList(); def_list.add(def); // Initialize a ConfigElementFactory with the needed // ConfigDefinition. And create a new ConfigElement. ConfigElementFactory temp_factory = new ConfigElementFactory(def_list); mConfigElement = temp_factory.create("New " + token, def); List list = CustomEditorRegistry.findEditors(token); Color start_color = new Color(160, 160, 180); Object color = UIManager.get("window"); if (null != color && color instanceof Color) { start_color = (Color) color; } else { System.out.println("Could not get the desktop color from the UIManager."); } // XXX:This will be used after making findEditors -> findEditor // if(null != editor) if (null == list || list.size() == 0) { System.out.println("No CustomEditors registered for token: " + token); JScrollPane scroll_pane = new JScrollPane(); PropertySheet element_prop_sheet = PropertySheetFactory.instance() .makeSheet(mConfigContext, mConfigElement, start_color); scroll_pane.getViewport().removeAll(); scroll_pane.getViewport().add(element_prop_sheet, null); cwp = scroll_pane; } else if (null != list && list.size() > 0) { CustomEditor editor = (CustomEditor) list.get(0); cwp = (JComponent) editor.getPanel(); editor.setConfig(mConfigContext, mConfigElement); } } } // cwp.init(mWhiteBoard); return cwp; }
public void doLayout() { Dimension sz = getSize(); textAreaMessage.setBounds(0, 0, sz.width, 50); int xparts = (sz.width - (2 * 125)) / 3; buttonOk.setBounds(xparts, 55, 125, 40); buttonCancel.setBounds(xparts + 125 + xparts, 55, 125, 40); scrollPane.setBounds(0, 100, sz.width, sz.height - 100); scrollPane.doLayout(); }
private void updateArchetypeDescription() { MavenArchetype sel = getSelectedArchetype(); String desc = sel == null ? null : sel.description; if (StringUtil.isEmptyOrSpaces(desc)) { myArchetypeDescriptionScrollPane.setVisible(false); } else { myArchetypeDescriptionScrollPane.setVisible(true); myArchetypeDescriptionField.setText(desc); } }
protected JComponent createCenterPanel() { JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myTree); scrollPane.setBorder(IdeBorderFactory.createBorder(SideBorder.LEFT)); myCenterPanel.add(CARD_STATUS, scrollPane); myTreeBrowser = new CommittedChangesTreeBrowser(myProject, Collections.<CommittedChangeList>emptyList()); Disposer.register(this, myTreeBrowser); myTreeBrowser.setHelpId(getHelpId()); myCenterPanel.add(CARD_CHANGES, myTreeBrowser); return myCenterPanel; }
/** * Creates the contents component of the application frame. By default the DrawingView is returned * in a JScrollPane. */ protected JComponent createContents(DrawingView view) { if (view instanceof Component) { JScrollPane sp = new JScrollPane((Component) view); sp.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); sp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); return sp; } else { return new JPanel(); } }
void initComponents() { JPanel mainPanel = new JPanel(new BorderLayout()); JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS)); Color bgColor = Color.getHSBColor(0.58f, 0.17f, 0.95f); buttonPanel.setBackground(bgColor); Border empty = BorderFactory.createEmptyBorder(5, 5, 5, 5); buttonPanel.setBorder(empty); textField = new JTextField(75); buttonPanel.add(textField); buttonPanel.add(Box.createHorizontalStrut(10)); searchPHI = new JButton("Search PHI"); searchPHI.addActionListener(this); buttonPanel.add(searchPHI); buttonPanel.add(Box.createHorizontalStrut(10)); searchTrial = new JButton("Search Trial IDs"); searchTrial.addActionListener(this); buttonPanel.add(searchTrial); buttonPanel.add(Box.createHorizontalStrut(20)); buttonPanel.add(Box.createHorizontalGlue()); saveAs = new JCheckBox("Save As..."); saveAs.setBackground(bgColor); buttonPanel.add(saveAs); mainPanel.add(buttonPanel, BorderLayout.NORTH); JScrollPane scrollPane = new JScrollPane(); textPane = new ColorPane(); // textPane.setEditable(false); scrollPane.setViewportView(textPane); mainPanel.add(scrollPane, BorderLayout.CENTER); JPanel footerPanel = new JPanel(); footerPanel.setLayout(new BoxLayout(footerPanel, BoxLayout.X_AXIS)); footerPanel.setBackground(bgColor); message = new JLabel("Ready..."); footerPanel.add(message); mainPanel.add(footerPanel, BorderLayout.SOUTH); setTitle(windowTitle); addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent evt) { System.exit(0); } }); getContentPane().add(mainPanel, BorderLayout.CENTER); pack(); centerFrame(); }
public CFInternetSwingVersionListJPanel( ICFInternetSwingSchema argSchema, ICFLibAnyObj argContainer, ICFInternetVersionObj argFocus, Collection<ICFInternetVersionObj> argDataCollection, ICFJRefreshCallback refreshCallback, boolean sortByChain) { super(); final String S_ProcName = "construct-schema-focus"; if (argSchema == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 1, "argSchema"); } // argFocus is optional; focus may be set later during execution as // conditions of the runtime change. swingSchema = argSchema; swingFocus = argFocus; swingContainer = argContainer; swingRefreshCallback = refreshCallback; swingSortByChain = sortByChain; setSwingDataCollection(argDataCollection); dataTable = new JTable(getDataModel(), getDataColumnModel(), getDataListSelectionModel()); dataTable.addMouseListener(getDataListMouseAdapter()); dataTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); dataTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); dataTable.setUpdateSelectionOnSort(true); dataTable.setRowHeight(25); getDataListSelectionModel().addListSelectionListener(getDataListSelectionListener()); dataScrollPane = new JScrollPane( dataTable, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); dataScrollPane.setColumnHeader( new JViewport() { @Override public Dimension getPreferredSize() { Dimension sz = super.getPreferredSize(); sz.height = 25; return (sz); } }); dataTable.setFillsViewportHeight(true); // Do initial layout setSize(1024, 480); JMenuBar menuBar = getPanelMenuBar(); add(menuBar); menuBar.setBounds(0, 0, 1024, 25); add(dataScrollPane); dataScrollPane.setBounds(0, 25, 1024, 455); adjustListMenuBar(); doLayout(); swingIsInitializing = false; }
/** Constructor. */ public TilePatternsView() { super(); tilePatternIcons = new ArrayList<TilePatternIcon>(); setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); // tileset properties // the tile pattern list // view of the current tile pattern // tileset properties tilesetPropertiesView = new TilesetPropertiesView(); tilesetPropertiesView.setMaximumSize(new Dimension(Integer.MAX_VALUE, 120)); tilesetPropertiesView.setAlignmentX(Component.LEFT_ALIGNMENT); // list tilePatternsListModel = new TilePatternsListModel(); tilePatternsList = new JList(tilePatternsListModel); tilePatternsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); tilePatternsList.setLayoutOrientation(JList.HORIZONTAL_WRAP); tilePatternsList.setVisibleRowCount(-1); // make the rows as wide as possible tilePatternsList .getSelectionModel() .addListSelectionListener(new TilePatternListSelectionListener()); tilePatternsList.setCellRenderer(new TilePatternListRenderer()); tilePatternsList.addKeyListener( new KeyAdapter() { public void keyPressed(KeyEvent keyEvent) { if (keyEvent.getKeyCode() == KeyEvent.VK_DELETE) { if (tileset != null && tileset.getSelectedTilePattern() != null) { tileset.removeTilePattern(); } } } }); JScrollPane listScroller = new JScrollPane(tilePatternsList); listScroller.setMaximumSize(new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE)); listScroller.setAlignmentX(Component.LEFT_ALIGNMENT); // tile view tilePatternView = new TilePatternView(); tilePatternView.setMaximumSize(new Dimension(Integer.MAX_VALUE, 300)); tilePatternView.setAlignmentX(Component.LEFT_ALIGNMENT); add(tilesetPropertiesView); add(Box.createRigidArea(new Dimension(0, 5))); add(listScroller); add(Box.createRigidArea(new Dimension(0, 5))); add(tilePatternView); }
ParameterInfoComponent( Object[] objects, Editor editor, @NotNull ParameterInfoHandler handler, boolean requestFocus) { super(new BorderLayout()); myRequestFocus = requestFocus; if (!ApplicationManager.getApplication().isUnitTestMode()) { JComponent editorComponent = editor.getComponent(); JLayeredPane layeredPane = editorComponent.getRootPane().getLayeredPane(); myWidthLimit = layeredPane.getWidth(); } NORMAL_FONT = UIUtil.getLabelFont(); BOLD_FONT = NORMAL_FONT.deriveFont(Font.BOLD); myObjects = objects; setBackground(BACKGROUND_COLOR); myHandler = handler; myPanels = new OneElementComponent[myObjects.length]; final JPanel panel = new JPanel(new GridBagLayout()); for (int i = 0; i < myObjects.length; i++) { myPanels[i] = new OneElementComponent(); panel.add( myPanels[i], new GridBagConstraints( 0, i, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); } if (myRequestFocus) { AccessibleContextUtil.setName( this, "Parameter Info. Press TAB to navigate through each element. Press ESC to close."); } final JScrollPane pane = ScrollPaneFactory.createScrollPane(panel); pane.setBorder(null); pane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); add(pane, BorderLayout.CENTER); myCurrentParameterIndex = -1; }
void addTextArea(JPanel panel, String key, String label) { JLabel lab = new JLabel(label); lab.setAlignmentX(LEFT_ALIGNMENT); panel.add(lab); JTextArea field = new JTextArea(); field.setText(sketch.configFile.get(key)); field.setLineWrap(true); field.setWrapStyleWord(true); fields.put(key, field); JScrollPane scroll = new JScrollPane(field); scroll.setAlignmentX(0.0f); panel.add(scroll); }
public MetalworksInBox() { super("In Box", true, true, true, true); DefaultMutableTreeNode unread; DefaultMutableTreeNode personal; DefaultMutableTreeNode business; DefaultMutableTreeNode spam; DefaultMutableTreeNode top = new DefaultMutableTreeNode("Mail Boxes"); top.add(unread = new DefaultMutableTreeNode("Unread Mail")); top.add(personal = new DefaultMutableTreeNode("Personal")); top.add(business = new DefaultMutableTreeNode("Business")); top.add(spam = new DefaultMutableTreeNode("Spam")); unread.add(new DefaultMutableTreeNode("Buy Stuff Now")); unread.add(new DefaultMutableTreeNode("Read Me Now")); unread.add(new DefaultMutableTreeNode("Hot Offer")); unread.add(new DefaultMutableTreeNode("Re: Re: Thank You")); unread.add(new DefaultMutableTreeNode("Fwd: Good Joke")); personal.add(new DefaultMutableTreeNode("Hi")); personal.add(new DefaultMutableTreeNode("Good to hear from you")); personal.add(new DefaultMutableTreeNode("Re: Thank You")); business.add(new DefaultMutableTreeNode("Thanks for your order")); business.add(new DefaultMutableTreeNode("Price Quote")); business.add(new DefaultMutableTreeNode("Here is the invoice")); business.add(new DefaultMutableTreeNode("Project Metal: delivered on time")); business.add(new DefaultMutableTreeNode("Your salary raise approved")); spam.add(new DefaultMutableTreeNode("Buy Now")); spam.add(new DefaultMutableTreeNode("Make $$$ Now")); spam.add(new DefaultMutableTreeNode("HOT HOT HOT")); spam.add(new DefaultMutableTreeNode("Buy Now")); spam.add(new DefaultMutableTreeNode("Don't Miss This")); spam.add(new DefaultMutableTreeNode("Opportunity in Precious Metals")); spam.add(new DefaultMutableTreeNode("Buy Now")); spam.add(new DefaultMutableTreeNode("Last Chance")); spam.add(new DefaultMutableTreeNode("Buy Now")); spam.add(new DefaultMutableTreeNode("Make $$$ Now")); spam.add(new DefaultMutableTreeNode("To Hot To Handle")); spam.add(new DefaultMutableTreeNode("I'm waiting for your call")); JTree tree = new JTree(top); JScrollPane treeScroller = new JScrollPane(tree); treeScroller.setBackground(tree.getBackground()); setContentPane(treeScroller); setSize(325, 200); setLocation(75, 75); }
protected void changeBorderDisplay() { if (showBorders) { setBorder(BorderFactory.createTitledBorder("DrawViewPanel")); fromListScrollPane.setBorder(BorderFactory.createTitledBorder("ScrollPane from list")); splitPane.setBorder(BorderFactory.createTitledBorder("Split Pane")); } else { setBorder(null); fromListScrollPane.setBorder(null); splitPane.setBorder(null); } // repaint(); }
public void createFileChooserDemo() { theImage = new JLabel(""); jpgIcon = createImageIcon("filechooser/jpgIcon.jpg", "jpg image"); gifIcon = createImageIcon("filechooser/gifIcon.gif", "gif image"); JPanel demoPanel = getDemoPanel(); demoPanel.setLayout(new BoxLayout(demoPanel, BoxLayout.Y_AXIS)); JPanel innerPanel = new JPanel(); innerPanel.setLayout(new BoxLayout(innerPanel, BoxLayout.X_AXIS)); demoPanel.add(Box.createRigidArea(VGAP20)); demoPanel.add(innerPanel); demoPanel.add(Box.createRigidArea(VGAP20)); innerPanel.add(Box.createRigidArea(HGAP20)); // Create a panel to hold buttons JPanel buttonPanel = new JPanel() { public Dimension getMaximumSize() { return new Dimension(getPreferredSize().width, super.getMaximumSize().height); } }; buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.Y_AXIS)); buttonPanel.add(Box.createRigidArea(VGAP15)); buttonPanel.add(createPlainFileChooserButton()); buttonPanel.add(Box.createRigidArea(VGAP15)); buttonPanel.add(createPreviewFileChooserButton()); buttonPanel.add(Box.createRigidArea(VGAP15)); buttonPanel.add(createCustomFileChooserButton()); buttonPanel.add(Box.createVerticalGlue()); // Create a panel to hold the image JPanel imagePanel = new JPanel(); imagePanel.setLayout(new BorderLayout()); imagePanel.setBorder(new BevelBorder(BevelBorder.LOWERED)); JScrollPane scroller = new JScrollPane(theImage); scroller.getVerticalScrollBar().setUnitIncrement(10); scroller.getHorizontalScrollBar().setUnitIncrement(10); imagePanel.add(scroller, BorderLayout.CENTER); // add buttons and image panels to inner panel innerPanel.add(buttonPanel); innerPanel.add(Box.createRigidArea(HGAP30)); innerPanel.add(imagePanel); innerPanel.add(Box.createRigidArea(HGAP20)); }
protected JScrollPane createDirectoryList() { directoryList = new JList(); align(directoryList); directoryList.setCellRenderer(new DirectoryCellRenderer()); directoryList.setModel(new MotifDirectoryListModel()); directoryList.addMouseListener(createDoubleClickListener(getFileChooser(), directoryList)); directoryList.addListSelectionListener(createListSelectionListener(getFileChooser())); JScrollPane scrollpane = new JScrollPane(directoryList); scrollpane.setMaximumSize(MAX_SIZE); scrollpane.setPreferredSize(prefListSize); align(scrollpane); return scrollpane; }
public CFSecuritySwingISOTimezoneFinderJPanel(ICFSecuritySwingSchema argSchema) { super(); final String S_ProcName = "construct-schema-focus"; if (argSchema == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 1, "argSchema"); } swingSchema = argSchema; dataTable = new JTable(getDataModel(), getDataColumnModel(), getDataListSelectionModel()); dataTable.addMouseListener(getDataListMouseAdapter()); dataTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); dataTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); dataTable.setUpdateSelectionOnSort(true); dataTable.setRowHeight(25); getDataListSelectionModel().addListSelectionListener(getDataListSelectionListener()); dataScrollPane = new JScrollPane( dataTable, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); dataScrollPane.setColumnHeader( new JViewport() { @Override public Dimension getPreferredSize() { Dimension sz = super.getPreferredSize(); sz.height = 25; return (sz); } }); dataTable.setFillsViewportHeight(true); add(dataScrollPane); loadData(true); doLayout(); swingIsInitializing = false; }
public CFSecuritySwingISOCurrencyAskDeleteJPanel( ICFSecuritySwingSchema argSchema, ICFSecurityISOCurrencyObj argFocus) { super(); final String S_ProcName = "construct-schema-focus"; if (argSchema == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 1, "argSchema"); } // argFocus is optional; focus may be set later during execution as // conditions of the runtime change. swingSchema = argSchema; swingFocus = argFocus; // Construct the various objects textAreaMessage = new JTextArea("Are you sure you want to delete this ISO Currency?"); actionOk = new ActionOk(); actionCancel = new ActionCancel(); buttonOk = new JButton(actionOk); buttonCancel = new JButton(actionCancel); attrJPanel = argSchema.getISOCurrencyFactory().newAttrJPanel(argFocus); scrollPane = new CFHSlaveJScrollPane(attrJPanel); // Lay out the widgets setSize(1024, 480); Dimension min = new Dimension(480, 300); setMinimumSize(min); add(textAreaMessage); textAreaMessage.setBounds(0, 0, 1024, 50); int xparts = (768 - (2 * 125)) / 3; add(buttonOk); buttonOk.setBounds(xparts, 55, 125, 40); add(buttonCancel); buttonCancel.setBounds(xparts + 125 + xparts, 55, 125, 40); add(scrollPane); scrollPane.setBounds(0, 100, 1024, 480 - 100); }
public void doLayout() { Dimension sz = getSize(); splitPane.setBounds(0, 0, sz.width, sz.height); splitPane.doLayout(); attrScrollPane.doLayout(); eltJTabbedPane.doLayout(); }
public void doLayout() { JComponent compo; Dimension sz = getSize(); compo = getPanelMenuBar(); compo.setBounds(0, 0, sz.width, 25); dataScrollPane.setBounds(0, 25, sz.width, sz.height - 25); }
private void jbInit() throws Exception { border1 = BorderFactory.createEmptyBorder(20, 20, 20, 20); contentPane.setBorder(border1); contentPane.setLayout(borderLayout1); controlsPane.setLayout(gridLayout1); gridLayout1.setColumns(1); gridLayout1.setHgap(10); gridLayout1.setRows(0); gridLayout1.setVgap(10); okButton.setVerifyInputWhenFocusTarget(true); okButton.setMnemonic('O'); okButton.setText("OK"); buttonsPane.setLayout(flowLayout1); flowLayout1.setAlignment(FlowLayout.CENTER); messagePane.setEditable(false); messagePane.setText(""); borderLayout1.setHgap(10); borderLayout1.setVgap(10); this.setTitle("Subscription Authorization"); this.getContentPane().add(contentPane, BorderLayout.CENTER); contentPane.add(controlsPane, BorderLayout.SOUTH); controlsPane.add(responsesComboBox, null); controlsPane.add(buttonsPane, null); buttonsPane.add(okButton, null); contentPane.add(messageScrollPane, BorderLayout.CENTER); messageScrollPane.getViewport().add(messagePane, null); }
public void go() { frame = new JFrame("Quiz Card Player"); JPanel mainPanel = new JPanel(); Font bigFont = new Font("sanserif", Font.BOLD, 24); display = new JTextArea(10, 20); display.setFont(bigFont); display.setLineWrap(true); display.setEditable(false); JScrollPane qScroller = new JScrollPane(display); qScroller.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); qScroller.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); nextButton = new JButton("Show Questions"); nextButton.addActionListener(new NextCardListener()); mainPanel.add(qScroller); mainPanel.add(nextButton); JMenuBar menuBar = new JMenuBar(); JMenu fileMenu = new JMenu("File"); JMenuItem loadMenuItem = new JMenuItem("Load Card Set"); loadMenuItem.addActionListener(new OpenMenuListener()); fileMenu.add(loadMenuItem); menuBar.add(fileMenu); frame.setJMenuBar(menuBar); frame.getContentPane().add(BorderLayout.CENTER, mainPanel); frame.setSize(640, 500); frame.setVisible(true); }