List of usage examples for javax.swing SwingConstants CENTER
int CENTER
To view the source code for javax.swing SwingConstants CENTER.
Click Source Link
From source file:com.sshtools.common.ui.SshToolsApplicationFrame.java
/** * * * @param application//from w ww .j a v a 2s .co m * @param panel * * @throws SshToolsApplicationException */ public void init(final SshToolsApplication application, SshToolsApplicationPanel panel) throws SshToolsApplicationException { this.panel = panel; this.application = application; if (application != null) { setTitle(ConfigurationLoader.getVersionString(application.getApplicationName(), application.getApplicationVersion())); // + " " + application.getApplicationVersion()); } setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); // Register the File menu panel.registerActionMenu(new SshToolsApplicationPanel.ActionMenu("File", "File", 'f', 0)); // Register the Exit action if (showExitAction && application != null) { panel.registerAction(exitAction = new ExitAction(application, this)); // Register the New Window Action } if (showNewWindowAction && application != null) { panel.registerAction(newWindowAction = new NewWindowAction(application)); // Register the Help menu } panel.registerActionMenu(new SshToolsApplicationPanel.ActionMenu("Help", "Help", 'h', 99)); // Register the About box action if (showAboutBox && application != null) { panel.registerAction(aboutAction = new AboutAction(this, application)); } // Register the Changelog box action if (showChangelogBox && application != null) { panel.registerAction(changelogAction = new ChangelogAction(this, application)); } panel.registerAction(faqAction = new FAQAction()); panel.registerAction(beginnerAction = new BeginnerAction()); panel.registerAction(advancedAction = new AdvancedAction()); getApplicationPanel().rebuildActionComponents(); JPanel p = new JPanel(new BorderLayout()); if (panel.getJMenuBar() != null) { setJMenuBar(panel.getJMenuBar()); } if (panel.getToolBar() != null) { JPanel t = new JPanel(new BorderLayout()); t.add(panel.getToolBar(), BorderLayout.NORTH); t.add(toolSeparator = new JSeparator(JSeparator.HORIZONTAL), BorderLayout.SOUTH); toolSeparator.setVisible(panel.getToolBar().isVisible()); final SshToolsApplicationPanel pnl = panel; panel.getToolBar().addComponentListener(new ComponentAdapter() { public void componentHidden(ComponentEvent evt) { log.debug("Tool separator is now " + pnl.getToolBar().isVisible()); toolSeparator.setVisible(pnl.getToolBar().isVisible()); } }); p.add(t, BorderLayout.NORTH); } p.add(panel, BorderLayout.CENTER); if (panel.getStatusBar() != null) { p.add(panel.getStatusBar(), BorderLayout.SOUTH); } getContentPane().setLayout(new GridLayout(1, 1)); getContentPane().add(p); // Watch for the frame closing setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent evt) { if (application != null) { application.closeContainer(SshToolsApplicationFrame.this); } else { int confirm = JOptionPane.showOptionDialog(SshToolsApplicationFrame.this, "Close " + getTitle() + "?", "Close Operation", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, null, null); if (confirm == 0) { hide(); } } } }); // If this is the first frame, center the window on the screen Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); boolean found = false; if (application != null && application.getContainerCount() != 0) { for (int i = 0; (i < application.getContainerCount()) && !found; i++) { SshToolsApplicationContainer c = application.getContainerAt(i); if (c instanceof SshToolsApplicationFrame) { SshToolsApplicationFrame f = (SshToolsApplicationFrame) c; setSize(f.getSize()); Point newLocation = new Point(f.getX(), f.getY()); newLocation.x += 48; newLocation.y += 48; if (newLocation.x > (screenSize.getWidth() - 64)) { newLocation.x = 0; } if (newLocation.y > (screenSize.getHeight() - 64)) { newLocation.y = 0; } setLocation(newLocation); found = true; } } } if (!found) { // Is there a previous stored geometry we can use? if (PreferencesStore.preferenceExists(PREF_LAST_FRAME_GEOMETRY)) { setBounds(PreferencesStore.getRectangle(PREF_LAST_FRAME_GEOMETRY, getBounds())); } else { pack(); UIUtil.positionComponent(SwingConstants.CENTER, this); } } }
From source file:com.funambol.foundation.admin.FileDataObjectSyncSourceConfigPanel.java
/** * Create the panel/*from w ww . j ava 2 s. c om*/ */ private void init() { // set layout this.setLayout(null); // set properties of label, position and border // referred to the title of the panel titledBorder1 = new TitledBorder(""); panelName.setFont(titlePanelFont); panelName.setText("Edit File Data Object SyncSource"); panelName.setBounds(new Rectangle(14, 5, 316, 28)); panelName.setAlignmentX(SwingConstants.CENTER); panelName.setBorder(titledBorder1); int y = 60; int dy = 30; sourceUriLabel.setText("Source URI: "); sourceUriLabel.setFont(defaultFont); sourceUriLabel.setBounds(new Rectangle(14, y, 150, 18)); sourceUriValue.setFont(defaultFont); sourceUriValue.setBounds(new Rectangle(170, y, 350, 18)); y += dy; nameLabel.setText("Name: "); nameLabel.setFont(defaultFont); nameLabel.setBounds(new Rectangle(14, y, 150, 18)); nameValue.setFont(defaultFont); nameValue.setBounds(new Rectangle(170, y, 350, 18)); y += dy; storageProviderLabel.setText("Storage type:"); storageProviderLabel.setFont(defaultFont); storageProviderLabel.setBounds(new Rectangle(14, y, 150, 18)); //list of supported storage providers String[] providers = new String[] { PROVIDER_FILESYSTEM, PROVIDER_S3 }; storageProviderValue = new JComboBox(providers); storageProviderValue.addActionListener(jcloudsProviderValueActionListener); storageProviderValue.setFont(defaultFont); storageProviderValue.setBounds(new Rectangle(170, y, 350, 18)); y += dy; // storageContainerNameLabel.setText("Provider container name:"); storageContainerNameLabel.setFont(defaultFont); storageContainerNameLabel.setBounds(new Rectangle(14, y, 150, 18)); storageContainerNameValue.setFont(defaultFont); storageContainerNameValue.setBounds(new Rectangle(170, y, 350, 18)); y += dy; // storageIdentityLabel.setText("Provider identity:"); storageIdentityLabel.setFont(defaultFont); storageIdentityLabel.setBounds(new Rectangle(14, y, 150, 18)); storageIdentityValue.setFont(defaultFont); storageIdentityValue.setBounds(new Rectangle(170, y, 350, 18)); //storage provider identity and storageFilesystemRootPathLabel aren't //showed together, so leaving the y coordinate equals the panel has a better //aspect for different storage types //y += dy; // storageFilesystemRootPathLabel.setText("Local path for filesystem provider:"); storageFilesystemRootPathLabel.setFont(defaultFont); storageFilesystemRootPathLabel.setBounds(new Rectangle(14, y, 150, 18)); storageFilesystemRootPathValue.setFont(defaultFont); storageFilesystemRootPathValue.setBounds(new Rectangle(170, y, 350, 18)); y += dy; // storageCredentialLabel.setText("Provider credential:"); storageCredentialLabel.setFont(defaultFont); storageCredentialLabel.setBounds(new Rectangle(14, y, 150, 18)); storageCredentialValue.setFont(defaultFont); storageCredentialValue.setBounds(new Rectangle(170, y, 350, 18)); y += dy; localRootPathLabel.setText("Root local path for temp files: "); localRootPathLabel.setFont(defaultFont); localRootPathLabel.setBounds(new Rectangle(14, y, 150, 18)); localRootPathValue.setFont(defaultFont); localRootPathValue.setBounds(new Rectangle(170, y, 350, 18)); y += dy; quotaLabel.setText("Quota: "); quotaLabel.setFont(defaultFont); quotaLabel.setBounds(new Rectangle(14, y, 150, 18)); model = new RolesTableModel(); quotaTable = new JTable(model); quotaTable.setFont(defaultFont); quotaTable.setShowGrid(true); quotaTable.setAutoscrolls(true); quotaTable.setSelectionMode(DefaultListSelectionModel.SINGLE_SELECTION); //add the table into a JScrollPanel, otherwise no columns headers and border //will be show JScrollPane scrollpane = new JScrollPane(quotaTable); scrollpane.setBounds(new Rectangle(170, y, 350, 110)); quotaTable.setPreferredScrollableViewportSize(new Dimension(350, 110)); y += dy + 75; notaLabel.setText( "<html>Please enter the number followed by 'M' if it is 'MegaBytes', or 'G' if it is 'GigaBytes'<BR>Example: '100 M' stands for 100 MegaBytes, '2 G' stands for 2 GigaBytes</html>"); notaLabel.setFont(defaultFont); notaLabel.setBounds(new Rectangle(170, y, 350, 54)); //button separed from other controls, and the height of the table y += dy + 36; confirmButton.setFont(defaultFont); confirmButton.setText("Add"); confirmButton.setBounds(170, y, 70, 25); confirmButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { try { validateValues(); getValues(); if (getState() == STATE_INSERT) { FileDataObjectSyncSourceConfigPanel.this .actionPerformed(new ActionEvent(FileDataObjectSyncSourceConfigPanel.this, ACTION_EVENT_INSERT, event.getActionCommand())); } else { FileDataObjectSyncSourceConfigPanel.this .actionPerformed(new ActionEvent(FileDataObjectSyncSourceConfigPanel.this, ACTION_EVENT_UPDATE, event.getActionCommand())); } } catch (Exception e) { notifyError(new AdminException(e.getMessage())); } } }); // add all components to the panel this.add(panelName, null); this.add(sourceUriLabel, null); this.add(sourceUriValue, null); this.add(nameLabel, null); this.add(nameValue, null); this.add(storageProviderLabel, null); this.add(storageProviderValue, null); this.add(storageContainerNameLabel, null); this.add(storageContainerNameValue, null); this.add(storageIdentityLabel, null); this.add(storageIdentityValue, null); this.add(storageCredentialLabel, null); this.add(storageCredentialValue, null); this.add(storageFilesystemRootPathLabel, null); this.add(storageFilesystemRootPathValue, null); this.add(localRootPathLabel, null); this.add(localRootPathValue, null); this.add(quotaLabel, null); this.add(scrollpane, null); this.add(notaLabel, null); this.add(confirmButton, null); }
From source file:edu.ku.brc.specify.ui.containers.ContainerTreePanel.java
/** * /*ww w. java 2 s . co m*/ */ private void createUI() { CellConstraints cc = new CellConstraints(); edaColObjPanel = new EditDeleteAddVertPanel(getEditColObjAL(), getDelColObjAL(), getAddColObjAL()); edaContnrPanel = new EditDeleteAddVertPanel(getEditContainerAL(), getDelContainerAL(), getAddContainerAL()); set(rootContainer, rootColObj); scrollPane = UIHelper.createScrollPane(tree, true); treeRenderer = new ContainerTreeRenderer(null, !isViewMode, isViewMode); treeRenderer.setEditable(true); treeRenderer.setLeafIcon( IconManager.getIcon(CollectionObject.class.getSimpleName(), IconManager.IconSize.Std32)); treeRenderer.setVerticalTextPosition(SwingConstants.CENTER); tree.setCellRenderer(treeRenderer); tree.addMouseListener(new MouseAdapter() { @Override public void mousePressed(final MouseEvent e) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { mousePressedOnTree(e); } }); } }); colObjAssocIcon = new JLabel( IconManager.getIcon(CollectionObject.class.getSimpleName(), IconManager.IconSize.Std20)); containerAssocIcon = new JLabel( IconManager.getIcon(Container.class.getSimpleName(), IconManager.IconSize.Std20)); colObjIcon = new JLabel( IconManager.getIcon(CollectionObject.class.getSimpleName(), IconManager.IconSize.Std20)); containerIcon = new JLabel( IconManager.getIcon(Container.class.getSimpleName(), IconManager.IconSize.Std20)); searchCOBtn = UIHelper.createIconBtn("Search", IconManager.IconSize.Std20, "", true, null); searchCNBtn = UIHelper.createIconBtn("Search", IconManager.IconSize.Std20, "", true, null); colObjIcon.setEnabled(false); containerIcon.setEnabled(false); containerPanel = new ViewBasedDisplayPanel(null, "ContainerBrief", Container.class.getName(), true, MultiView.NO_OPTIONS); // Right Vertical Control Panel PanelBuilder rpb = null; if (!isViewMode) { rpb = new PanelBuilder(new FormLayout("f:p:g", "p,2px,p,2px,p,10px,p, 20px,p,2px,p,10px,p,f:p:g")); PanelBuilder cnCOLblPB = new PanelBuilder(new FormLayout("p,1px,p", "p")); cnCOLblPB.add(containerAssocIcon, cc.xy(1, 1)); cnCOLblPB.add(colObjAssocIcon, cc.xy(3, 1)); containerAssocIcon.setEnabled(false); colObjAssocIcon.setEnabled(false); int y = 1; rpb.add(containerIcon, cc.xy(1, y)); y += 2; rpb.add(edaContnrPanel, cc.xy(1, y)); y += 2; rpb.add(searchCNBtn, cc.xy(1, y)); y += 2; rpb.addSeparator("", cc.xy(1, y)); y += 2; rpb.add(colObjIcon, cc.xy(1, y)); y += 2; rpb.add(edaColObjPanel, cc.xy(1, y)); y += 2; rpb.add(searchCOBtn, cc.xy(1, y)); y += 2; } // Main Layout PanelBuilder pb = new PanelBuilder(new FormLayout("l:p,8px,f:p:g", "f:p:g,10px,p,2px,p"), this); if (rpb != null) { pb.add(rpb.getPanel(), cc.xy(1, 1)); } pb.add(scrollPane, cc.xy(3, 1)); //pb.addSeparator("Container", cc.xyw(1,3,3)); //pb.add(containerPanel, cc.xyw(1,5,3)); //pb.setDefaultDialogBorder(); tree.getSelectionModel().addTreeSelectionListener(new TreeSelectionListener() { @Override public void valueChanged(TreeSelectionEvent e) { updateBtnUI(); currContainer = null; currColObj = null; DefaultMutableTreeNode node = getSelectedTreeNode(); if (node != null) { if (node.getUserObject() instanceof Container) { currContainer = (Container) node.getUserObject(); if (containerPanel != null) { containerPanel.getMultiView().setData(currContainer); } } else if (node.getUserObject() instanceof CollectionObject) { currColObj = (CollectionObject) node.getUserObject(); } } } }); GhostGlassPane glassPane = (GhostGlassPane) UIRegistry.get(UIRegistry.GLASSPANE); glassPane.add((GhostActionable) tree); tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); tree.setShowsRootHandles(true); searchCOBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { addColObjToContainer(true, false); } }); searchCNBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { addContainer(true); } }); FormViewObj fvo = containerPanel.getMultiView().getCurrentViewAsFormViewObj(); if (fvo != null) { Component comp = fvo.getCompById("nm"); if (comp instanceof ValTextField) { final ValTextField nameTF = fvo.getCompById("nm"); nameTF.getDocument().addDocumentListener(new DocumentAdaptor() { @Override protected void changed(DocumentEvent e) { nameFieldChanged(nameTF.getText()); if (changeListener != null) changeListener.stateChanged(null); } }); final ValComboBox typeCBX = fvo.getCompById("typ"); typeCBX.getComboBox().addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { PickListItemIFace pli = (PickListItemIFace) typeCBX.getComboBox().getSelectedItem(); typeChanged(pli == null ? -1 : Integer.parseInt(pli.getValue())); if (changeListener != null) changeListener.stateChanged(null); } }); } } }
From source file:MainProgram.MainProgram.java
private void initComponents() throws InterruptedException { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents welcomeMessage = new JLabel(); welcomeMessage2 = new JLabel(); pennIDLabel = new JLabel(); pennIDTextField = new JTextField(); pennPassLabel = new JLabel(); pennPassField = new JPasswordField(); emailLabel = new JLabel(); emailTextField = new JTextField(); emailDomainLabel = new JLabel(); emailPassLabel = new JLabel(); emailPassField = new JPasswordField(); semesterLabel = new JLabel(); semesterComboBox = new JComboBox(semestersString); credentials = new JLabel(); dropLabel = new JLabel(); dropCheckBox = new JCheckBox(); button = new JButton(); stopWatchLabel = new JLabel(); checkMail = false;/*from w w w.j av a 2 s .c o m*/ testConnection = false; mailCheckTimeInitializer(); StopWatchInitializer(); try { setUIFont(new javax.swing.plaf.FontUIResource("Segoe UI", Font.ROMAN_BASELINE, 12)); } catch (Exception e) { e.printStackTrace(MainProgram.errorLog); } String lcOSName = System.getProperty("os.name").toLowerCase(); boolean IS_MAC = lcOSName.startsWith("mac os x"); //======== this ======== setLayout(new GridBagLayout()); ((GridBagLayout) getLayout()).columnWidths = new int[] { 81, 5, 119, 5, 0, 0 }; if (!IS_MAC) { ((GridBagLayout) getLayout()).rowHeights = new int[] { 17, 5, 0, 5, 0, 5, 0, 5, 0, 5, 0, 5, 0, 0, 0, 0 }; } ((GridBagLayout) getLayout()).rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0E-4 }; GridBagConstraints constraints = new GridBagConstraints(); constraints.gridx = 0; constraints.gridy = 0; constraints.fill = GridBagConstraints.HORIZONTAL; //---- welcomeMessage ---- welcomeMessage.setText("Course Registration"); welcomeMessage.setHorizontalAlignment(SwingConstants.CENTER); add(welcomeMessage, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); //---- welcomeMessage2 ---- welcomeMessage2.setText("for Penn State (BETA)"); welcomeMessage2.setHorizontalAlignment(SwingConstants.CENTER); add(welcomeMessage2, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); //---- pennIDLabel ---- pennIDLabel.setText("Penn State ID: "); pennIDLabel.setHorizontalAlignment(SwingConstants.RIGHT); add(pennIDLabel, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); //---- pennIDTextField ---- pennIDTextField.setText("xxx123"); add(pennIDTextField, new GridBagConstraints(1, 4, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); //---- pennPassLabel ---- pennPassLabel.setText("Penn State Password: "); pennPassLabel.setHorizontalAlignment(SwingConstants.RIGHT); add(pennPassLabel, new GridBagConstraints(0, 6, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); add(pennPassField, new GridBagConstraints(1, 6, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); //---- emailLabel ---- emailLabel.setText("Email: "); emailLabel.setHorizontalAlignment(SwingConstants.RIGHT); add(emailLabel, new GridBagConstraints(0, 8, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); //---- emailTextField ---- emailTextField.setText("myEmail"); add(emailTextField, new GridBagConstraints(1, 8, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); //---- emailDomainLabel ---- emailDomainLabel.setText("@mail.com"); add(emailDomainLabel, new GridBagConstraints(2, 8, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); //---- emailPassLabel ---- emailPassLabel.setText("Email Password: "); emailPassLabel.setHorizontalAlignment(SwingConstants.RIGHT); add(emailPassLabel, new GridBagConstraints(0, 10, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); add(emailPassField, new GridBagConstraints(1, 10, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); //---- Semester label ---- semesterLabel.setText("Semester/Drop Option: "); semesterLabel.setHorizontalAlignment(SwingConstants.RIGHT); add(semesterLabel, new GridBagConstraints(0, 13, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); //---- Semester ComboBox ---- add(semesterComboBox, new GridBagConstraints(1, 13, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); //---- Drop CheckBox ---- add(dropCheckBox, new GridBagConstraints(2, 13, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); //---- button ---- button.setText("Start"); add(button, new GridBagConstraints(1, 16, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); //---- stopWatchLabel ---- stopWatchLabel.setText(" " + stopWatchSplitting[0]); stopWatchLabel.setHorizontalAlignment(SwingConstants.LEFT); add(stopWatchLabel, new GridBagConstraints(2, 16, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); //---- label11 ---- credentials.setText(" Created by Daniyar Yeralin"); credentials.setForeground(Color.gray); credentials.setHorizontalAlignment(SwingConstants.RIGHT); credentials.setFont(new Font("Cambria", Font.ITALIC, 12)); add(credentials, new GridBagConstraints(2, 17, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); /*button.registerKeyboardAction(button.getActionForKeyStroke( KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, 0, false)), KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0, false), JComponent.WHEN_FOCUSED); button.registerKeyboardAction(button.getActionForKeyStroke( KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, 0, true)), KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0, true), JComponent.WHEN_FOCUSED);*/ StartButtonHandler buttonListener = new StartButtonHandler(); button.addActionListener(buttonListener); }
From source file:edu.ku.brc.specify.config.init.DatabasePanel.java
/** * Creates a dialog for entering database name and selecting the appropriate driver. *//* w w w .j a v a 2 s .c o m*/ @SuppressWarnings("unchecked") public DatabasePanel(final JButton nextBtn, final JButton prevBtn, final String helpContext, final boolean doSetDefaultValues) { super("DATABASE", helpContext, nextBtn, prevBtn); this.doSetDefaultValues = doSetDefaultValues; int t = 0; // for (int p : SKIP_DB_CREATE_PERMS) { // t |= p; // } // PERM_SKIP_DB_CREATE = t; // // t = 0; for (int p : CREATE_DB_PERMS) { t |= p; } PERM_CREATE_DB = t; PERM_SKIP_DB_CREATE = t; //see comments in createSkipDBCreatePerms() createSkipDBCreatePerms(); createCreateDBPerms(); String header = getResourceString("ENTER_DB_INFO") + ":"; CellConstraints cc = new CellConstraints(); String rowDef = "p,2px," + UIHelper.createDuplicateJGoodiesDef("p", "2px", 7) + ",10px,p,10px,p,4px,p,4px,p"; PanelBuilder builder = new PanelBuilder(new FormLayout("p,2px,p:g", rowDef), this); int row = 1; builder.add(createLabel(header, SwingConstants.CENTER), cc.xywh(1, row, 3, 1)); row += 2; usernameTxt = createField(builder, "IT_USERNAME", true, row); row += 2; passwordTxt = createField(builder, "IT_PASSWORD", true, row, true, null); row += 2; dbNameTxt = createField(builder, "DB_NAME", true, row); row += 2; hostNameTxt = createField(builder, "HOST_NAME", true, row); row += 2; driverList = DatabaseDriverInfo.getDriversList(); drivers = (JComboBox<DatabaseDriverInfo>) createComboBox(driverList); // MySQL as the default drivers.setSelectedItem(DatabaseDriverInfo.getDriver("MySQL")); JLabel lbl = createI18NFormLabel("DRIVER", SwingConstants.RIGHT); lbl.setFont(bold); builder.add(lbl, cc.xy(1, row)); builder.add(drivers, cc.xy(3, row)); row += 2; builder.add(createLabel(" "), cc.xy(1, row)); // spacer row += 2; isStructureOnly = createCheckBox(builder, "CONVUPLD_CHKBX", row); isStructureOnly.setToolTipText(getResourceString("CONVUPLD_CHKBX_TT")); isStructureOnly.setVisible(!UIRegistry.isMobile() && !UIRegistry.isEmbedded()); row += 2; label = UIHelper.createLabel("", SwingConstants.CENTER); createDBBtn = UIHelper.createI18NButton("CREATE_DB"); PanelBuilder tstPB = new PanelBuilder(new FormLayout("f:p:g,p,f:p:g", "p")); tstPB.add(createDBBtn, cc.xy(2, 1)); PanelBuilder panelPB = new PanelBuilder(new FormLayout("f:p:g", "20px,p,2px,p,8px,p")); panelPB.add(tstPB.getPanel(), cc.xy(1, 2)); panelPB.add(getProgressBar(), cc.xy(1, 4)); panelPB.add(label, cc.xy(1, 6)); builder.add(panelPB.getPanel(), cc.xy(3, row)); row += 2; // Advance part of pane advLabel = UIHelper.createI18NLabel("ADV_DB_DESC", SwingConstants.CENTER); skipStepBtn = UIHelper.createI18NButton("ADV_DB_TEST"); JComponent sep = builder.addSeparator(UIRegistry.getResourceString("ADV_TITLE"), cc.xyw(3, row, 1)); row += 2; builder.add(advLabel, cc.xyw(3, row, 1)); row += 2; tstPB = new PanelBuilder(new FormLayout("f:p:g,p,f:p:g", "p")); tstPB.add(skipStepBtn, cc.xy(2, 1)); builder.add(tstPB.getPanel(), cc.xyw(3, row, 1)); row += 2; skipStepBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { createDBBtn.setEnabled(false); skipStepBtn.setEnabled(false); boolean ok = skipDBCreate(); createDBBtn.setEnabled(true); skipStepBtn.setEnabled(true); advLabel.setText(UIRegistry.getResourceString(ok ? "ADV_DB_OK" : "ADV_DB_ERR")); } }); createDBBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { createDB(); } }); if (UIRegistry.isMobile()) { skipStepBtn.setVisible(false); advLabel.setVisible(false); sep.setVisible(false); } progressBar.setVisible(false); DocumentAdaptor docAdp = new DocumentAdaptor() { @Override protected void changed(DocumentEvent e) { updateBtnUI(); } }; usernameTxt.getDocument().addDocumentListener(docAdp); passwordTxt.getDocument().addDocumentListener(docAdp); dbNameTxt.getDocument().addDocumentListener(docAdp); hostNameTxt.getDocument().addDocumentListener(docAdp); updateBtnUI(); }
From source file:net.java.sip.communicator.gui.AuthenticationSplash.java
/** * * We use dynamic layout managers, so that layout is dynamic and will * adapt properly to user-customized fonts and localized text. The * GridBagLayout makes it easy to line up components of varying * sizes along invisible vertical and horizontal grid lines. It * is important to sketch the layout of the interface and decide * on the grid before writing the layout code. * * Here we actually use/*from ww w .j ava 2 s .c o m*/ * our own subclass of GridBagLayout called StringGridBagLayout, * which allows us to use strings to specify constraints, rather * than having to create GridBagConstraints objects manually. * * * We use the JLabel.setLabelFor() method to connect * labels to what they are labeling. This allows mnemonics to work * and assistive to technologies used by persons with disabilities * to provide much more useful information to the user. */ private void initComponents(final Frame parent) { Container contents = getContentPane(); contents.setLayout(new BorderLayout()); String title = Utils.getProperty("net.java.sip.communicator.gui.AUTH_WIN_TITLE"); if (title == null) title = "Login Manager"; setTitle(title); setResizable(false); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent event) { dialogDone(CMD_CANCEL, parent); } }); // Accessibility -- all frames, dialogs, and applets should // have a description getAccessibleContext().setAccessibleDescription("Authentication Splash"); String authPromptLabelValue = Utils.getProperty("net.java.sip.communicator.gui.AUTHENTICATION_PROMPT"); if (authPromptLabelValue == null) authPromptLabelValue = "Please register to the service or enter your credentials to log in:"; JLabel splashLabel = new JLabel(authPromptLabelValue); splashLabel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); splashLabel.setHorizontalAlignment(SwingConstants.CENTER); splashLabel.setHorizontalTextPosition(SwingConstants.CENTER); contents.add(splashLabel, BorderLayout.NORTH); JPanel centerPane = new JPanel(); centerPane.setLayout(new GridBagLayout()); userNameTextField = new JTextField(); // needed below // user name label JLabel userNameLabel = new JLabel(); userNameLabel.setDisplayedMnemonic('U'); // setLabelFor() allows the mnemonic to work userNameLabel.setLabelFor(userNameTextField); String userNameLabelValue = Utils.getProperty("net.java.sip.communicator.gui.USER_NAME_LABEL"); if (userNameLabelValue == null) userNameLabelValue = "Username"; int gridy = 0; userNameLabel.setText(userNameLabelValue); GridBagConstraints c = new GridBagConstraints(); c.gridx = 0; c.gridy = gridy; c.anchor = GridBagConstraints.WEST; c.insets = new Insets(12, 12, 0, 0); centerPane.add(userNameLabel, c); // user name text c = new GridBagConstraints(); c.gridx = 1; c.gridy = gridy++; c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 1.0; c.insets = new Insets(12, 7, 0, 11); centerPane.add(userNameTextField, c); passwordTextField = new JPasswordField(); //needed below // password label JLabel passwordLabel = new JLabel(); passwordLabel.setDisplayedMnemonic('P'); passwordLabel.setLabelFor(passwordTextField); String pLabelStr = PropertiesDepot.getProperty("net.java.sip.communicator.gui.PASSWORD_LABEL"); if (pLabelStr == null) pLabelStr = "Password"; passwordLabel.setText(pLabelStr); c = new GridBagConstraints(); c.gridx = 0; c.gridy = gridy; c.anchor = GridBagConstraints.WEST; c.insets = new Insets(11, 12, 0, 0); centerPane.add(passwordLabel, c); // password text passwordTextField.setEchoChar('\u2022'); c = new GridBagConstraints(); c.gridx = 1; c.gridy = gridy++; c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 1.0; c.insets = new Insets(11, 7, 0, 11); centerPane.add(passwordTextField, c); //Set a relevant realm value //Bug report by Steven Lass (sltemp at comcast.net) //JLabel realmValueLabel = new JLabel("SipPhone.com"); // needed below // realm label JLabel realmLabel = new JLabel(); realmLabel.setDisplayedMnemonic('R'); realmLabel.setLabelFor(realmValueLabel); realmLabel.setText("Realm"); realmValueLabel = new JLabel(); // Buttons along bottom of window JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new BoxLayout(buttonPanel, 0)); loginButton = new JButton(); loginButton.setText("Login"); loginButton.setActionCommand(CMD_LOGIN); loginButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { dialogDone(event, parent); } }); buttonPanel.add(loginButton); // space buttonPanel.add(Box.createRigidArea(new Dimension(5, 0))); registerButton = new JButton(); registerButton.setMnemonic('G'); registerButton.setText("Register"); registerButton.setActionCommand(CMD_REGISTER); registerButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { dialogDone(event, parent); } }); buttonPanel.add(registerButton); buttonPanel.add(Box.createRigidArea(new Dimension(5, 0))); cancelButton = new JButton(); cancelButton.setText("Cancel"); cancelButton.setActionCommand(CMD_CANCEL); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { dialogDone(event, parent); } }); buttonPanel.add(cancelButton); c = new GridBagConstraints(); c.gridx = 0; c.gridy = 3; c.gridwidth = 2; c.insets = new Insets(11, 12, 11, 11); centerPane.add(buttonPanel, c); contents.add(centerPane, BorderLayout.CENTER); getRootPane().setDefaultButton(loginButton); equalizeButtonSizes(); setFocusTraversalPolicy(new FocusTraversalPol()); }
From source file:edu.ku.brc.af.ui.forms.ResultSetController.java
/** * Creates the UI for the controller./*from w w w .ja va 2 s. c o m*/ * @param addNewBtn indicates it should include the "Add" (New Object) button * @param addDelBtn indicates it should include Delete button * @param objTitle the title of a single object in the controller (used for building tooltips) */ protected void buildRecordNavBar(final boolean addNewBtn, final boolean addDelBtn, final boolean addSearchBtn, final String objTitle) { String colDef = "p,2dlu,p,2dlu,max(50dlu;p):grow,2dlu,p,2dlu,p" + (addNewBtn ? ",12px,p" : "") + (addDelBtn ? ",2dlu,p" : "") + (addSearchBtn ? ",2dlu,p" : ""); Insets insets = new Insets(1, 1, 1, 1); DefaultFormBuilder rowBuilder = new DefaultFormBuilder(new FormLayout(colDef, "p")); firstBtn = UIHelper.createIconBtn("FirstRec", null, null); prevBtn = UIHelper.createIconBtn("PrevRec", null, null); btnsHash.put(CommandType.Previous, prevBtn); btnsHash.put(CommandType.First, firstBtn); recDisp = createLabel(" "); recDisp.setHorizontalAlignment(SwingConstants.CENTER); recDisp.setOpaque(true); recDisp.setBackground(Color.WHITE); recDisp.setBorder(enabledBorder); recDisp.setFont(recDisp.getFont().deriveFont(recDisp.getFont().getSize2D() - 2)); MouseListener mouseListener = new MouseAdapter() { private boolean showIfPopupTrigger(MouseEvent mouseEvent) { if (mouseEvent.isPopupTrigger()) { JPopupMenu popupMenu = createPopupMenu(); if (popupMenu != null && popupMenu.getComponentCount() > 0) { popupMenu.show(mouseEvent.getComponent(), mouseEvent.getX(), mouseEvent.getY()); return true; } } return false; } @Override public void mousePressed(MouseEvent mouseEvent) { showIfPopupTrigger(mouseEvent); } @Override public void mouseReleased(MouseEvent mouseEvent) { showIfPopupTrigger(mouseEvent); } /* (non-Javadoc) * @see java.awt.event.MouseAdapter#mouseClicked(java.awt.event.MouseEvent) */ @Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { if (numRecords == 1) { UIRegistry.writeTimedSimpleGlassPaneMsg(getResourceString("OnlyOneRrecordInCon")); } else { showGotoRecDlg(); } } } }; recDisp.addMouseListener(mouseListener); nextBtn = UIHelper.createIconBtn("NextRec", null, null); lastBtn = UIHelper.createIconBtn("LastRec", null, null); btnsHash.put(CommandType.Next, nextBtn); btnsHash.put(CommandType.Last, lastBtn); firstBtn.setToolTipText(createTooltip("GotoFirstRecordTT", objTitle)); prevBtn.setToolTipText(createTooltip("GotoPreviousRecordTT", objTitle)); nextBtn.setToolTipText(createTooltip("GotoNextRecordTT", objTitle)); lastBtn.setToolTipText(createTooltip("GotoLastRecordTT", objTitle)); firstBtn.setOpaque(false); prevBtn.setOpaque(false); nextBtn.setOpaque(false); lastBtn.setOpaque(false); CellConstraints cc = new CellConstraints(); rowBuilder.add(firstBtn, cc.xy(1, 1)); rowBuilder.add(prevBtn, cc.xy(3, 1)); rowBuilder.add(recDisp, cc.xy(5, 1)); rowBuilder.add(nextBtn, cc.xy(7, 1)); rowBuilder.add(lastBtn, cc.xy(9, 1)); int col = 11; if (addNewBtn) { if (false) { newRecBtn = new JButton("+") { public void setEnabled(boolean enable) { //log.debug("newRecBtn - RS: "+ formValidator.getName() + " " + newRecBtn.hashCode() + " "+enable+" isNewObj: "+isNewObj); if (formValidator != null && formValidator.getName() != null && formValidator.getName().equals("Collection Object")) { int x = 0; x++; if (enable) { int y = 0; y++; } } if (enable) { int x = 0; x++; } super.setEnabled(enable); } }; setControlSize(newRecBtn); ActionListener l = new ActionListener() { public void actionPerformed(ActionEvent ae) { for (ResultSetControllerListener rscl : listeners) { rscl.newRecordAdded(); } } }; newRecBtn.addActionListener(l); } else { newRecBtn = UIHelper.createIconBtn("NewRecord", null, new ActionListener() { public void actionPerformed(ActionEvent ae) { for (ResultSetControllerListener rscl : listeners) { rscl.newRecordAdded(); } } }); } newRecBtn.setToolTipText(createTooltip("NewRecordTT", objTitle)); newRecBtn.setEnabled(true); newRecBtn.setMargin(insets); btnsHash.put(CommandType.NewItem, newRecBtn); if (doLayoutBtns) { rowBuilder.add(newRecBtn, cc.xy(col, 1)); col += 2; } } if (addDelBtn) { if (false) { delRecBtn = new JButton("-") { public void setEnabled(boolean enable) { //log.debug("delRecBtn - RS: "+formValidator.getName() + " " + hashCode() + " "+enable); if (formValidator != null && formValidator.getName() != null && formValidator.getName().equals("Permit")) { int x = 0; x++; } if (!enable) { int x = 0; x++; } super.setEnabled(enable); } }; } else { delRecBtn = UIHelper.createIconBtn("DeleteRecord", null, null); } delRecBtn.setToolTipText(createTooltip("DeleteRecordTT", objTitle)); delRecBtn.setMargin(insets); btnsHash.put(CommandType.DelItem, delRecBtn); if (doLayoutBtns) { rowBuilder.add(delRecBtn, cc.xy(col, 1)); col += 2; } } if (addSearchBtn) { searchRecBtn = UIHelper.createIconBtn("Search", IconManager.IconSize.Std16, null, null); searchRecBtn.setToolTipText(createTooltip("SearchForRecordTT", objTitle)); searchRecBtn.setMargin(insets); if (doLayoutBtns) { rowBuilder.add(searchRecBtn, cc.xy(col, 1)); col += 2; } } firstBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { firstRecord(); } }); prevBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { prevRecord(); } }); nextBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { nextRecord(); } }); lastBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { lastRecord(); } }); // Make sure it gets centered rowBuilder.getPanel().setOpaque(false); DefaultFormBuilder outerCenteredPanel = new DefaultFormBuilder(new FormLayout("c:p:g", "p")); outerCenteredPanel.add(rowBuilder.getPanel(), cc.xy(1, 1)); panel = outerCenteredPanel.getPanel(); panel.setOpaque(false); }
From source file:edu.ku.brc.specify.utilapps.sp5utils.Sp5Forms.java
/** * //from w ww . ja v a 2 s . co m */ protected void createUI() { CellConstraints cc = new CellConstraints(); PanelBuilder pb = new PanelBuilder(new FormLayout("f:p:g,p,p:g", "p,2px,f:p:g,4px,p,2px,p,10px,p")); missingFieldsList = new JList(new DefaultListModel()); formsTable = new JTable(new FormCellModel(forms)); formsTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { if (formsTable.getSelectedRow() > -1) { formSelected(); } } }); fieldsTable = new JTable(fieldsTableModel = new FieldCellModel()); TableColumn col = fieldsTable.getColumnModel().getColumn(1); col.setCellEditor(sp6FieldEditor = new Sp6FieldComboBoxEditor()); // If the cell should appear like a combobox in its // non-editing state, also set the combobox renderer //col.setCellRenderer(sp6FieldRenderer = new Sp6FieldComboBoxRenderer()); calcColumnWidths(formsTable); PanelBuilder pbBtn = new PanelBuilder(new FormLayout("f:p:g,p,f:p:g,p,f:p:g,p,f:p:g,p,f:p:g", "p")); reportBtn = createButton("Create Form Images"); showBtn = createButton("Show"); schemaBtn = createButton("Schema"); dataCheckerBtn = createButton("Check For Nulls"); pbBtn.add(reportBtn, cc.xy(2, 1)); pbBtn.add(schemaBtn, cc.xy(4, 1)); pbBtn.add(showBtn, cc.xy(6, 1)); pbBtn.add(dataCheckerBtn, cc.xy(8, 1)); pb.add(createLabel("Forms", SwingConstants.CENTER), cc.xy(1, 1)); pb.add(createLabel("Missing Fields", SwingConstants.CENTER), cc.xy(3, 1)); pb.add(createScrollPane(formsTable), cc.xy(1, 3)); pb.add(createScrollPane(missingFieldsList), cc.xy(3, 3)); pb.add(createLabel("Form Fields", SwingConstants.CENTER), cc.xyw(1, 5, 3)); pb.add(createScrollPane(fieldsTable), cc.xyw(1, 7, 3)); pb.add(pbBtn.getPanel(), cc.xyw(1, 9, 3)); pb.setDefaultDialogBorder(); setContentPane(new JScrollPane(pb.getPanel())); showBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { showForm(); } }); reportBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { doCreateFormImages(); } }); schemaBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { doSchema(); } }); dataCheckerBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { TableDataChecker tdc = new TableDataChecker(DBConnection.getInstance().createConnection()); tdc.doCheckDB(); } }); }
From source file:DateChooserPanel.java
/** * Returns a panel of buttons, each button representing a day in the month. * This is a sub-component of the DatePanel. * * @return the panel./*from ww w . j av a 2s. com*/ */ private JPanel getCalendarPanel() { final JPanel p = new JPanel(new GridLayout(7, 7)); final DateFormatSymbols dateFormatSymbols = new DateFormatSymbols(); final String[] weekDays = dateFormatSymbols.getShortWeekdays(); for (int i = 0; i < this.WEEK_DAYS.length; i++) { p.add(new JLabel(weekDays[this.WEEK_DAYS[i]], SwingConstants.CENTER)); } this.buttons = new JButton[42]; for (int i = 0; i < 42; i++) { final JButton b = new JButton(""); b.setMargin(new Insets(1, 1, 1, 1)); b.setName(Integer.toString(i)); b.setFont(this.dateFont); b.setFocusPainted(false); b.setActionCommand("dateButtonClicked"); b.addActionListener(this); this.buttons[i] = b; p.add(b); } return p; }
From source file:edu.ku.brc.stats.StatGroupTable.java
/** * Constructor with the localized name of the Group * @param name name of the group (already been localized) * @param useSeparator use non-border separator titles *//*from w ww. jav a 2s. c om*/ public StatGroupTable(final String name, final String[] columnNames, final boolean useSeparator, final int numRows) { this.name = name; this.useSeparator = useSeparator; this.skinItem = SkinsMgr.getSkinItem("StatGroup"); if (progressIcon == null) { progressIcon = IconManager.getIcon("Progress", IconManager.IconSize.Std16); } setLayout(new BorderLayout()); setBackground(Color.WHITE); model = new StatGroupTableModel(this, columnNames); //table = numRows > SCROLLPANE_THRESOLD ? (new SortableJTable(new SortableTableModel(model))) : (new JTable(model)); if (numRows > SCROLLPANE_THRESOLD) { table = new SortableJTable(new SortableTableModel(model)) { protected void configureEnclosingScrollPane() { Container p = getParent(); if (p instanceof JViewport) { Container gp = p.getParent(); if (gp instanceof JScrollPane) { JScrollPane scrollPane = (JScrollPane) gp; // Make certain we are the viewPort's view and not, for // example, the rowHeaderView of the scrollPane - // an implementor of fixed columns might do this. JViewport viewport = scrollPane.getViewport(); if (viewport == null || viewport.getView() != this) { return; } // scrollPane.setColumnHeaderView(getTableHeader()); //scrollPane.getViewport().setBackingStoreEnabled(true); scrollPane.setBorder(UIManager.getBorder("Table.scrollPaneBorder")); } } } }; } else { table = new JTable(model) { protected void configureEnclosingScrollPane() { Container p = getParent(); if (p instanceof JViewport) { Container gp = p.getParent(); if (gp instanceof JScrollPane) { JScrollPane scrollPane = (JScrollPane) gp; // Make certain we are the viewPort's view and not, for // example, the rowHeaderView of the scrollPane - // an implementor of fixed columns might do this. JViewport viewport = scrollPane.getViewport(); if (viewport == null || viewport.getView() != this) { return; } // scrollPane.setColumnHeaderView(getTableHeader()); //scrollPane.getViewport().setBackingStoreEnabled(true); scrollPane.setBorder(UIManager.getBorder("Table.scrollPaneBorder")); } } } }; } table.setShowVerticalLines(false); table.setShowHorizontalLines(false); if (SkinsMgr.shouldBeOpaque(skinItem)) { table.setOpaque(false); setOpaque(false); } else { table.setOpaque(true); setOpaque(true); } table.addMouseMotionListener(new TableMouseMotion()); table.addMouseListener(new LinkListener()); if (table.getColumnModel().getColumnCount() == 1) { table.getColumnModel().getColumn(0) .setCellRenderer(new StatGroupTableCellRenderer(SwingConstants.CENTER, 1)); } else { table.getColumnModel().getColumn(0) .setCellRenderer(new StatGroupTableCellRenderer(SwingConstants.LEFT, 2)); table.getColumnModel().getColumn(1) .setCellRenderer(new StatGroupTableCellRenderer(SwingConstants.RIGHT, 2)); } //table.setRowSelectionAllowed(true); if (numRows > SCROLLPANE_THRESOLD) { scrollPane = new JScrollPane(table, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); if (table instanceof SortableJTable) { ((SortableJTable) table).installColumnHeaderListeners(); } scrollPane.setOpaque(false); scrollPane.getViewport().setOpaque(false); scrollPane.setBorder(BorderFactory.createEmptyBorder()); //scrollPane.getViewport().setBorder(BorderFactory.createEmptyBorder()); } if (useSeparator) { setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); CellConstraints cc = new CellConstraints(); if (StringUtils.isNotEmpty(name)) { builder.addSeparator(name, cc.xy(1, 1)); } builder.add(scrollPane != null ? scrollPane : table, cc.xy(1, 2)); builder.getPanel().setOpaque(false); add(builder.getPanel()); } else { setBorder(BorderFactory.createEmptyBorder(15, 2, 2, 2)); setBorder(BorderFactory.createCompoundBorder(new CurvedBorder(new Color(160, 160, 160)), getBorder())); add(scrollPane != null ? scrollPane : table, BorderLayout.CENTER); } }