List of usage examples for javax.swing JLabel setText
@BeanProperty(preferred = true, visualUpdate = true, description = "Defines the single line of text this component will display.") public void setText(String text)
From source file:org.tinymediamanager.ui.settings.ExternalServicesSettingsPanel.java
public ExternalServicesSettingsPanel() { setLayout(new FormLayout( new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, })); {// w ww . j a v a2 s . c o m JPanel panelTrakttv = new JPanel(); panelTrakttv.setBorder(new TitledBorder(null, BUNDLE.getString("Settings.trakttv"), TitledBorder.LEADING, TitledBorder.TOP, null, null)); add(panelTrakttv, "2, 2, fill, fill"); panelTrakttv.setLayout(new FormLayout( new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("max(25dlu;default)"), FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), FormSpecs.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, })); final JLabel lblTraktStatus = new JLabel(""); //$NON-NLS-1$ panelTrakttv.add(lblTraktStatus, "2, 2, 5, 1"); JButton btnGetTraktPin = new JButton(BUNDLE.getString("Settings.trakt.getpin")); //$NON-NLS-1$ panelTrakttv.add(btnGetTraktPin, "2, 4"); JButton btnTestTraktConnection = new JButton(BUNDLE.getString("Settings.trakt.testconnection")); //$NON-NLS-1$ panelTrakttv.add(btnTestTraktConnection, "4, 4"); if (!Globals.isDonator()) { btnGetTraktPin.setEnabled(false); btnTestTraktConnection.setEnabled(false); String msg = "<html><body>" + BUNDLE.getString("tmm.donatorfunction.hint") + "</body></html>"; //$NON-NLS-1$ JLabel lblTraktDonator = new JLabel(msg); lblTraktDonator.setForeground(Color.RED); panelTrakttv.add(lblTraktDonator, "2, 8, 3, 1, default, default"); } else { if (StringUtils.isNoneBlank(Globals.settings.getTraktAccessToken(), Globals.settings.getTraktRefreshToken())) { lblTraktStatus.setText(BUNDLE.getString("Settings.trakt.status.good")); //$NON-NLS-1$ } else { lblTraktStatus.setText(BUNDLE.getString("Settings.trakt.status.bad")); //$NON-NLS-1$ } btnGetTraktPin.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { // open the pin url in a browser try { TmmUIHelper.browseUrl("https://trakt.tv/pin/799"); } catch (Exception e1) { // browser could not be opened, show a dialog box JOptionPane.showMessageDialog(MainWindow.getFrame(), BUNDLE.getString("Settings.trakt.getpin.fallback"), //$NON-NLS-1$ BUNDLE.getString("Settings.trakt.getpin"), JOptionPane.INFORMATION_MESSAGE); } // let the user insert the pin String pin = JOptionPane.showInputDialog(MainWindow.getFrame(), BUNDLE.getString("Settings.trakt.getpin.entercode")); //$NON-NLS-1$ // try to get the tokens String accessToken = ""; String refreshToken = ""; try { Map<String, String> tokens = TraktTv.authenticateViaPin(pin); accessToken = tokens.get("accessToken") == null ? "" : tokens.get("accessToken"); refreshToken = tokens.get("refreshToken") == null ? "" : tokens.get("refreshToken"); } catch (Exception e1) { } Globals.settings.setTraktAccessToken(accessToken); Globals.settings.setTraktRefreshToken(refreshToken); if (StringUtils.isNoneBlank(Globals.settings.getTraktAccessToken(), Globals.settings.getTraktRefreshToken())) { lblTraktStatus.setText(BUNDLE.getString("Settings.trakt.status.good")); //$NON-NLS-1$ } else { JOptionPane.showMessageDialog(MainWindow.getFrame(), BUNDLE.getString("Settings.trakt.getpin.problem"), BUNDLE.getString("Settings.trakt.getpin"), JOptionPane.ERROR_MESSAGE);//$NON-NLS-1$ lblTraktStatus.setText(BUNDLE.getString("Settings.trakt.status.bad")); //$NON-NLS-1$ } } }); btnTestTraktConnection.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { TraktTv.refreshAccessToken(); JOptionPane.showMessageDialog(MainWindow.getFrame(), BUNDLE.getString("Settings.trakt.testconnection.good"), BUNDLE.getString("Settings.trakt.testconnection"), JOptionPane.ERROR_MESSAGE);//$NON-NLS-1$ } catch (Exception e1) { JOptionPane.showMessageDialog(MainWindow.getFrame(), BUNDLE.getString("Settings.trakt.testconnection.bad"), BUNDLE.getString("Settings.trakt.testconnection"), JOptionPane.ERROR_MESSAGE);//$NON-NLS-1$ } } }); } } initDataBindings(); }
From source file:org.ut.biolab.medsavant.client.filter.FilterEffectivenessPanel.java
public FilterEffectivenessPanel(Color foregroundColor) { GridBagConstraints gbc = new GridBagConstraints(); gbc.gridx = 0;//w w w .j a v a 2 s. c o m gbc.gridy = 0; gbc.gridwidth = 1; gbc.gridheight = 1; gbc.fill = GridBagConstraints.BOTH; gbc.weightx = 1.0; gbc.weighty = 1.0; this.setPreferredSize(new Dimension(280, 80)); this.setMaximumSize(new Dimension(280, 80)); setLayout(new GridBagLayout()); waitPanel = new WaitPanel("Applying Filters"); waitPanel.setVisible(false); add(waitPanel, gbc, JLayeredPane.DRAG_LAYER); panel = ViewUtil.getClearPanel(); panel.setLayout(new BorderLayout()); panel.setBorder(ViewUtil.getMediumBorder()); //panel.setPreferredSize(waitPanel.getPreferredSize()); add(panel, gbc, JLayeredPane.DEFAULT_LAYER); labelVariantsRemaining = ViewUtil.getDetailTitleLabel(""); labelVariantsRemaining.setForeground(foregroundColor); JPanel infoPanel = ViewUtil.getClearPanel(); ViewUtil.applyVerticalBoxLayout(infoPanel); final JLabel a = new JLabel(""); a.setForeground(foregroundColor); ViewUtil.makeSmall(a); infoPanel.add(ViewUtil.centerHorizontally(a)); Listener<FilterEvent> fe = new Listener<FilterEvent>() { @Override public void handleEvent(FilterEvent event) { try { if (MedSavantClient.VariantManager.willApproximateCountsForConditions( LoginController.getSessionID(), ProjectController.getInstance().getCurrentProjectID(), ReferenceController.getInstance().getCurrentReferenceID(), FilterController.getInstance().getAllFilterConditions())) { a.setText("approximately"); } else { a.setText(""); } } catch (Exception ex) { ex.printStackTrace(); } } }; fe.handleEvent(null); FilterController.getInstance().addListener(fe); infoPanel.add(ViewUtil.centerHorizontally(labelVariantsRemaining)); JLabel l = new JLabel("of all variants pass search conditions"); l.setForeground(foregroundColor); ViewUtil.makeSmall(l); infoPanel.add(ViewUtil.centerHorizontally(l)); infoPanel.setBorder(ViewUtil.getMediumTopHeavyBorder()); panel.add(infoPanel, BorderLayout.NORTH); initListeners(); }
From source file:org.ut.biolab.medsavant.client.patient.AddPatientsForm.java
/** This method is called from within the constructor to * initialize the form.//ww w . ja v a 2s .c om * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { scrollPane = new javax.swing.JScrollPane(); table = new javax.swing.JTable(); addButton = new javax.swing.JButton(); javax.swing.JLabel jLabel1 = new javax.swing.JLabel(); doneButton = new javax.swing.JButton(); tipLabel = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); setTitle("Import Patients"); table.setModel( new javax.swing.table.DefaultTableModel( new Object[][] { { null, null, null, null }, { null, null, null, null }, { null, null, null, null }, { null, null, null, null } }, new String[] { "Title 1", "Title 2", "Title 3", "Title 4" })); scrollPane.setViewportView(table); addButton.setText("Add Individual"); addButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { addButtonActionPerformed(evt); } }); jLabel1.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N jLabel1.setText("Add Single Patient:"); doneButton.setText("Done"); doneButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { doneButtonActionPerformed(evt); } }); tipLabel.setText(" "); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup().addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(scrollPane, javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addComponent(tipLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(addButton)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addGap(0, 0, Short.MAX_VALUE).addComponent(doneButton))) .addContainerGap())); layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup().addContainerGap().addComponent(jLabel1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(scrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 283, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(addButton).addComponent(tipLabel)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(doneButton) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); pack(); }
From source file:org.ut.biolab.medsavant.client.query.view.NumberSearchConditionEditorView.java
private void setExtremeValues(DecimalRangeSlider slider, JLabel fromLabel, JLabel toLabel, JTextField fromBox, JTextField toBox, int precision, Range extremeValues) { //if (columnName.equals("dp")) { // extremeValues = new Range(Math.min(0, extremeValues.getMin()),extremeValues.getMax()); //}//from w ww . j a va 2 s. c om int overallMin = (int) Math.floor(extremeValues.getMin()); int overallMax = (int) Math.ceil(extremeValues.getMax()); if (overallMax - overallMin <= 1) { precision = 2; } else if (overallMax - overallMin <= 10) { precision = 1; } slider.setPrecision(precision); slider.setMinimum(overallMin); slider.setMaximum(overallMax); slider.setLow(overallMin); slider.setHigh(overallMax); slider.updateUI(); fromBox.setText(ViewUtil.numToString(overallMin)); toBox.setText(ViewUtil.numToString(overallMax)); fromLabel.setText(ViewUtil.numToString(overallMin)); toLabel.setText(ViewUtil.numToString(overallMax)); }
From source file:org.ut.biolab.medsavant.client.variant.VariantWorker.java
/** * Initialise functionality shared by all UpdateWorkers and PublicationWorkers. * * @param activity "Importing", "Publishing", or "Removing" * @param wizard the wizard which is providing the user interface * @param progressLabel label which indicates progress activity * @param progressBar provides quantitative display of progress * @param workButton starts the process and cancels it *//*from ww w .j a va 2s . c o m*/ VariantWorker(String activity, WizardDialog wizard, JLabel progressLabel, JProgressBar progressBar, JButton workButton) { super(activity + "Variants"); this.activity = activity; this.wizard = wizard; this.progressLabel = progressLabel; this.progressBar = progressBar; this.workButton = workButton; progressLabel.setText(String.format("%s ...", activity)); // Convert our start button into a cancel button. workButton.setText("Cancel"); if (workButton.getActionListeners().length > 0) { workButton.removeActionListener(workButton.getActionListeners()[0]); } workButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { VariantWorker.this.progressBar.setIndeterminate(true); VariantWorker.this.workButton.setText("Cancelling..."); VariantWorker.this.workButton.setEnabled(false); cancel(true); } }); workButton.setEnabled(true); wizard.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); }
From source file:org.ut.biolab.medsavant.client.view.app.builtin.settings.AddRemoveDatabaseDialog.java
/** This method is called from within the constructor to * initialize the form./* www . j a v a2 s. c o m*/ * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { okButton = new javax.swing.JButton(); cancelButton = new javax.swing.JButton(); javax.swing.JPanel detailsPanel = new javax.swing.JPanel(); javax.swing.JLabel jLabel3 = new javax.swing.JLabel(); hostField = new javax.swing.JTextField(); javax.swing.JLabel jLabel4 = new javax.swing.JLabel(); portField = new javax.swing.JTextField(); javax.swing.JLabel jLabel5 = new javax.swing.JLabel(); databaseField = new javax.swing.JTextField(); javax.swing.JLabel jLabel6 = new javax.swing.JLabel(); passwordField = new javax.swing.JPasswordField(); javax.swing.JLabel jLabel7 = new javax.swing.JLabel(); userField = new javax.swing.JTextField(); setTitle("Create Database"); setBackground(new java.awt.Color(217, 222, 229)); okButton.setText("Create"); okButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { okButtonActionPerformed(evt); } }); cancelButton.setText("Cancel"); cancelButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cancelButtonActionPerformed(evt); } }); detailsPanel.setBackground(getBackground()); detailsPanel.setOpaque(false); jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabel3.setText("SERVER ADDRESS"); hostField.setFont(new java.awt.Font("Lucida Grande", 0, 15)); // NOI18N hostField.setHorizontalAlignment(javax.swing.JTextField.CENTER); jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabel4.setText("SERVER PORT"); portField.setFont(new java.awt.Font("Lucida Grande", 0, 15)); // NOI18N portField.setHorizontalAlignment(javax.swing.JTextField.CENTER); jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabel5.setText("DATABASE NAME"); databaseField.setFont(new java.awt.Font("Lucida Grande", 0, 15)); // NOI18N databaseField.setHorizontalAlignment(javax.swing.JTextField.CENTER); jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabel6.setText("ADMIN USERNAME"); passwordField.setFont(new java.awt.Font("Lucida Grande", 0, 15)); // NOI18N passwordField.setHorizontalAlignment(javax.swing.JTextField.CENTER); jLabel7.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabel7.setText("ADMIN PASSWORD"); userField.setFont(new java.awt.Font("Lucida Grande", 0, 15)); // NOI18N userField.setHorizontalAlignment(javax.swing.JTextField.CENTER); org.jdesktop.layout.GroupLayout detailsPanelLayout = new org.jdesktop.layout.GroupLayout(detailsPanel); detailsPanel.setLayout(detailsPanelLayout); detailsPanelLayout.setHorizontalGroup(detailsPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(detailsPanelLayout.createSequentialGroup().addContainerGap().add(detailsPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(org.jdesktop.layout.GroupLayout.TRAILING, jLabel3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 440, Short.MAX_VALUE) .add(org.jdesktop.layout.GroupLayout.TRAILING, hostField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 440, Short.MAX_VALUE) .add(jLabel4, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 440, Short.MAX_VALUE) .add(org.jdesktop.layout.GroupLayout.TRAILING, portField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 440, Short.MAX_VALUE) .add(jLabel5, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 440, Short.MAX_VALUE) .add(databaseField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 440, Short.MAX_VALUE) .add(jLabel6, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 440, Short.MAX_VALUE) .add(jLabel7, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 440, Short.MAX_VALUE) .add(passwordField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 440, Short.MAX_VALUE) .add(org.jdesktop.layout.GroupLayout.TRAILING, userField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 440, Short.MAX_VALUE)) .addContainerGap())); detailsPanelLayout .setVerticalGroup(detailsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(detailsPanelLayout.createSequentialGroup().addContainerGap().add(jLabel3) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(hostField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(jLabel4) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(portField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(jLabel5) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(databaseField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(jLabel6) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(userField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(jLabel7) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(passwordField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup().addContainerGap(285, Short.MAX_VALUE).add(okButton) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(cancelButton) .addContainerGap()) .add(detailsPanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)); layout.linkSize(new java.awt.Component[] { cancelButton, okButton }, org.jdesktop.layout.GroupLayout.HORIZONTAL); layout.setVerticalGroup(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup() .add(detailsPanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .add(18, 18, 18).add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(cancelButton).add(okButton)) .addContainerGap())); getRootPane().setDefaultButton(okButton); pack(); }
From source file:org.ut.biolab.medsavant.client.view.component.KeyValuePairPanel.java
public void addKey(final String key, boolean showExpand) { Color rowColor = Color.WHITE; if (keyKeyComponentMap.size() % 2 == 0) { rowColor = ViewUtil.getAlternateRowColor(); }/* w ww .j ava2s . c om*/ if (newRowsGoIntoMoreSection) { keysInMoreSection.add(key); } rowColor = Color.white; String layoutConstraints = "insets 3 3 3 3, filly"; JPanel valuePanel = ViewUtil.getClearPanel(); valuePanel.setLayout(new MigLayout(layoutConstraints)); valuePanel.setBackground(rowColor); int i = 0; JPanel keyPanel = ViewUtil.getClearPanel(); keyPanel.setLayout(new MigLayout(layoutConstraints + ", alignx right, hmin 30")); keyPanel.setBackground(rowColor); final JLabel keyLabel = getKeyLabel(key); //keyLabel.setBorder(ViewUtil.getMediumBorder()); keyKeyComponentMap.put(key, keyLabel); if (showExpand) { keyLabel.setText("? " + key.toUpperCase()); keyLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); keyLabel.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent me) { toggleMoreVisibility(); if (keyLabel.getText().startsWith("?")) { keyLabel.setText("? " + key.toUpperCase()); } else { keyLabel.setText("? " + key.toUpperCase()); } } }); } keyPanel.add(keyLabel); keyLabel.setVisible(keysVisible); kvpPanel.add(keyPanel, incrementConstraintRow(i++)); kvpPanel.add(valuePanel, incrementConstraintRow(i++)); JPanel[] extraComponents = new JPanel[additionalColumns]; for (int j = 0; j < additionalColumns; j++) { JPanel panel = ViewUtil.getClearPanel(); panel.setBackground(rowColor); ViewUtil.applyHorizontalBoxLayout(panel); //panel.setBorder(border); //panel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); extraComponents[j] = panel;//ViewUtil.getClearPanel(); kvpPanel.add(extraComponents[j], incrementConstraintRow(i++)); } // add hidden panel keyDetailConstraints.gridy++; keyDetailConstraints.gridy++; JPanel detailPanel = ViewUtil.getClearPanel(); detailPanel.setBackground(rowColor); //detailPanel.setBorder(ViewUtil.getTinyLineBorder()); detailPanel.setVisible(false); keyDetailComponentMap.put(key, detailPanel); kvpPanel.add(detailPanel, keyDetailConstraints); // update all constraints to skip a line for (int k = 0; k < 2 + additionalColumns; k++) { incrementConstraintRow(k); } keyValueComponentMap.put(key, valuePanel); keyExtraComponentsMap.put(key, extraComponents); setMoreVisibility(showingMore); }
From source file:org.ut.biolab.medsavant.client.view.component.KeyValuePairPanel.java
public void simpleEllipsify() { for (String k : keyValueComponentMap.keySet()) { JComponent comp = getComponent(k); if (comp instanceof JLabel) { JLabel l = (JLabel) comp; String s = l.getText(); if (s.length() > 25) { s = s.substring(0, 20) + "..."; }/*from w w w. j av a2 s .c o m*/ l.setText(s); } } }
From source file:org.ut.biolab.medsavant.client.view.LoginView.java
/** This method is called from within the constructor to * initialize the form./*from w w w.ja v a 2 s . co m*/ * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; titlePanel = new javax.swing.JPanel(); userField = new javax.swing.JTextField(); passwordField = new javax.swing.JPasswordField(); spiralPanel = new javax.swing.JPanel(); versionLabel = new javax.swing.JLabel(); javax.swing.JLabel userLabel = new javax.swing.JLabel(); javax.swing.JLabel passwordLabel = new javax.swing.JLabel(); javax.swing.JToggleButton button_settings = new javax.swing.JToggleButton(); detailsPanel = new javax.swing.JPanel(); javax.swing.JLabel hostLabel = new javax.swing.JLabel(); hostField = new javax.swing.JTextField(); javax.swing.JLabel portLabel = new javax.swing.JLabel(); portField = new javax.swing.JTextField(); javax.swing.JButton dbCreateButton = new javax.swing.JButton(); databaseField = new javax.swing.JTextField(); javax.swing.JLabel databaseLabel = new javax.swing.JLabel(); javax.swing.JButton dbRemoveButton = new javax.swing.JButton(); loginButton = new javax.swing.JButton(); progressSigningIn = new javax.swing.JProgressBar(); setLayout(new java.awt.GridBagLayout()); titlePanel.setBackground(new java.awt.Color(255, 255, 255)); titlePanel.setBorder(javax.swing.BorderFactory.createEmptyBorder(6, 6, 6, 6)); titlePanel.setMaximumSize(new java.awt.Dimension(400, 32767)); titlePanel.setMinimumSize(new java.awt.Dimension(400, 800)); titlePanel.setOpaque(false); userField.setColumns(25); userField.setHorizontalAlignment(javax.swing.JTextField.CENTER); userField.addKeyListener(new java.awt.event.KeyAdapter() { public void keyPressed(java.awt.event.KeyEvent evt) { userFieldKeyPressed(evt); } }); passwordField.setColumns(25); passwordField.setHorizontalAlignment(javax.swing.JTextField.CENTER); passwordField.addKeyListener(new java.awt.event.KeyAdapter() { public void keyPressed(java.awt.event.KeyEvent evt) { passwordFieldKeyPressed(evt); } }); spiralPanel.setPreferredSize(new java.awt.Dimension(150, 150)); javax.swing.GroupLayout spiralPanelLayout = new javax.swing.GroupLayout(spiralPanel); spiralPanel.setLayout(spiralPanelLayout); spiralPanelLayout.setHorizontalGroup(spiralPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 0, Short.MAX_VALUE)); spiralPanelLayout.setVerticalGroup(spiralPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 150, Short.MAX_VALUE)); versionLabel.setFont(versionLabel.getFont()); versionLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); versionLabel.setText("version information"); userLabel.setFont(new java.awt.Font("Helvetica", 0, 12)); // NOI18N userLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); userLabel.setText("USERNAME"); passwordLabel.setFont(new java.awt.Font("Helvetica", 0, 12)); // NOI18N passwordLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); passwordLabel.setText("PASSWORD"); button_settings.setText("Connection Settings"); button_settings.putClientProperty("JButton.buttonType", "textured"); button_settings.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { button_settingsActionPerformed(evt); } }); detailsPanel.setBackground(new java.awt.Color(204, 204, 204)); detailsPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Connection Settings", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION)); detailsPanel.setName("Connection Settings"); // NOI18N detailsPanel.setOpaque(false); hostLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); hostLabel.setText("SERVER ADDRESS"); hostField.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N hostField.setHorizontalAlignment(javax.swing.JTextField.CENTER); hostField.addKeyListener(new java.awt.event.KeyAdapter() { public void keyPressed(java.awt.event.KeyEvent evt) { hostFieldKeyPressed(evt); } }); portLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); portLabel.setText("SERVER PORT"); portField.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N portField.setHorizontalAlignment(javax.swing.JTextField.CENTER); portField.addKeyListener(new java.awt.event.KeyAdapter() { public void keyPressed(java.awt.event.KeyEvent evt) { portFieldKeyPressed(evt); } }); dbCreateButton.setText("Create Database"); dbCreateButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { dbCreateButtonActionPerformed(evt); } }); databaseField.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N databaseField.setHorizontalAlignment(javax.swing.JTextField.CENTER); databaseField.addKeyListener(new java.awt.event.KeyAdapter() { public void keyPressed(java.awt.event.KeyEvent evt) { databaseFieldKeyPressed(evt); } }); databaseLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); databaseLabel.setText("DATABASE NAME"); dbRemoveButton.setText("Remove Database"); dbRemoveButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { dbRemoveButtonActionPerformed(evt); } }); javax.swing.GroupLayout detailsPanelLayout = new javax.swing.GroupLayout(detailsPanel); detailsPanel.setLayout(detailsPanelLayout); detailsPanelLayout.setHorizontalGroup(detailsPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(databaseLabel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(detailsPanelLayout.createSequentialGroup().addContainerGap().addGroup(detailsPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(hostLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(hostField).addComponent(portField) .addComponent(portLabel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, detailsPanelLayout.createSequentialGroup().addComponent(dbRemoveButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(dbCreateButton)) .addComponent(databaseField, javax.swing.GroupLayout.Alignment.TRAILING)) .addContainerGap())); detailsPanelLayout.setVerticalGroup(detailsPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(detailsPanelLayout.createSequentialGroup().addComponent(hostLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(hostField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(portLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(portField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(databaseLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(databaseField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(detailsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(dbCreateButton).addComponent(dbRemoveButton)))); loginButton.setBackground(new java.awt.Color(0, 0, 0)); loginButton.setText("Log In"); loginButton.putClientProperty("JButton.buttonType", "textured"); loginButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { loginButtonActionPerformed(evt); } }); progressSigningIn.setIndeterminate(true); javax.swing.GroupLayout titlePanelLayout = new javax.swing.GroupLayout(titlePanel); titlePanel.setLayout(titlePanelLayout); titlePanelLayout.setHorizontalGroup(titlePanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(versionLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(spiralPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 416, Short.MAX_VALUE) .addComponent(detailsPanel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(titlePanelLayout.createSequentialGroup() .addGroup(titlePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(userLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(titlePanelLayout.createSequentialGroup().addContainerGap() .addGroup(titlePanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(button_settings).addComponent(userField, javax.swing.GroupLayout.PREFERRED_SIZE, 201, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(0, 0, Short.MAX_VALUE))) .addGroup(titlePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(titlePanelLayout.createSequentialGroup().addGap(6, 6, 6).addComponent( passwordLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 189, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, titlePanelLayout .createSequentialGroup() .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(titlePanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, titlePanelLayout.createSequentialGroup() .addComponent(progressSigningIn, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(loginButton)) .addComponent(passwordField, javax.swing.GroupLayout.PREFERRED_SIZE, 197, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap())))); titlePanelLayout.setVerticalGroup(titlePanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, titlePanelLayout.createSequentialGroup() .addComponent(spiralPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(versionLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(titlePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(userLabel).addComponent(passwordLabel)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(titlePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(userField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(passwordField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(titlePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(loginButton) .addComponent(progressSigningIn, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(button_settings)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(detailsPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 2; gridBagConstraints.gridwidth = 3; gridBagConstraints.gridheight = 3; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.insets = new java.awt.Insets(45, 45, 45, 45); add(titlePanel, gridBagConstraints); }
From source file:org.webcat.plugintester.ui.MainFrameBuilder.java
/** * Creates and lays out the Swing components for the window. * * @param frame the JFrame instance that will contain the components */// www . j a va 2s .co m private void constructFrame(JFrame frame) { GridBagConstraints gridBagConstraints; fileChooser = new JFileChooser(); bottomPanel = new JPanel(); runButton = new JButton(); mainPanel = new JPanel(); JLabel webCatHomeLabel = new JLabel(); webCatHomeField = new JTextField(); webCatHomeBrowseButton = new JButton(); JSeparator jSeparator0 = new JSeparator(); JLabel submissionLabel = new JLabel(); submissionField = new JTextField(); submissionBrowseButton = new JButton(); JSeparator jSeparator1 = new JSeparator(); JLabel pluginsLabel = new JLabel(); JPanel pluginsPanel = new JPanel(); JScrollPane pluginsScrollPane = new JScrollPane(); pluginsTable = new JTable(); pluginAddButton = new JButton(); pluginRemoveButton = new JButton(); JSeparator jSeparator2 = new JSeparator(); JTabbedPane tabPane = new JTabbedPane(); propertiesPanel = new JPanel(); JScrollPane propertiesScrollPane = new JScrollPane(); propertiesEditor = new JEditorPane(); documentationPanel = new JPanel(); JScrollPane documentationScrollPane = new JScrollPane(); documentationEditor = new JEditorPane(); // File chooser fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); // Bottom panel bottomPanel.setLayout(new FlowLayout(FlowLayout.CENTER, 4, 4)); // Run button runButton.setText("Run Plug-ins"); runButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { runButtonActionPerformed(evt); } }); bottomPanel.add(runButton); frame.getContentPane().add(bottomPanel, BorderLayout.PAGE_END); // Main panel mainPanel.setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6)); mainPanel.setLayout(new GridBagLayout()); // Web-CAT Home field gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = GridBagConstraints.RELATIVE; gridBagConstraints.anchor = GridBagConstraints.LINE_START; webCatHomeLabel.setText("Web-CAT Home:"); mainPanel.add(webCatHomeLabel, gridBagConstraints); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 1.0; webCatHomeField.setTransferHandler(new WebCATHomeTransferHandler()); mainPanel.add(webCatHomeField, gridBagConstraints); // Web-CAT Home browse button webCatHomeBrowseButton.setText("Browse..."); webCatHomeBrowseButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { webCatHomeBrowseButtonActionPerformed(evt); } }); mainPanel.add(webCatHomeBrowseButton, new GridBagConstraints()); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER; gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; mainPanel.add(jSeparator0, gridBagConstraints); // Submission field gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = GridBagConstraints.RELATIVE; gridBagConstraints.anchor = GridBagConstraints.LINE_START; submissionLabel.setText("Submission:"); mainPanel.add(submissionLabel, gridBagConstraints); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 1.0; submissionField.setTransferHandler(new SubmissionTransferHandler()); mainPanel.add(submissionField, gridBagConstraints); // Submission browse button submissionBrowseButton.setText("Browse..."); submissionBrowseButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { submissionBrowseButtonActionPerformed(evt); } }); mainPanel.add(submissionBrowseButton, new GridBagConstraints()); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER; gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; mainPanel.add(jSeparator1, gridBagConstraints); // Plug-ins area pluginsLabel.setText("Plug-ins to run:"); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER; gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; mainPanel.add(pluginsLabel, gridBagConstraints); pluginsPanel.setPreferredSize(new Dimension(400, 80)); pluginsPanel.setLayout(new GridBagLayout()); pluginsModel = new PluginsTableModel(); pluginsTable.setModel(pluginsModel); pluginsTable.setColumnSelectionAllowed(true); pluginsTable.getTableHeader().setReorderingAllowed(false); pluginsScrollPane.setViewportView(pluginsTable); pluginsTable.getColumnModel().getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION); pluginsTable.getColumnModel().getColumn(0).setResizable(false); pluginsScrollPane.setTransferHandler(new PluginsTransferHandler()); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.gridheight = GridBagConstraints.REMAINDER; gridBagConstraints.fill = GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; pluginsPanel.add(pluginsScrollPane, gridBagConstraints); pluginAddButton.setText("Add..."); pluginAddButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { pluginAddButtonActionPerformed(evt); } }); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = GridBagConstraints.PAGE_START; pluginsPanel.add(pluginAddButton, gridBagConstraints); pluginRemoveButton.setText("Remove"); pluginRemoveButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { pluginRemoveButtonActionPerformed(evt); } }); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = GridBagConstraints.PAGE_START; pluginsPanel.add(pluginRemoveButton, gridBagConstraints); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER; gridBagConstraints.fill = GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 0.25; mainPanel.add(pluginsPanel, gridBagConstraints); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER; gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; mainPanel.add(jSeparator2, gridBagConstraints); tabPane.setPreferredSize(new Dimension(466, 150)); propertiesPanel.setLayout(new GridBagLayout()); propertiesEditor.addKeyListener(new KeyAdapter() { public void keyTyped(KeyEvent e) { propertiesTimer.restart(); } }); propertiesTimer = new Timer(1000, new ActionListener() { public void actionPerformed(ActionEvent e) { updateGradingProperties(); } }); propertiesScrollPane.setViewportView(propertiesEditor); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.fill = GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; propertiesPanel.add(propertiesScrollPane, gridBagConstraints); tabPane.addTab("Properties", propertiesPanel); documentationPanel.setLayout(new GridBagLayout()); documentationEditor.setContentType("text/html"); documentationEditor.setEditable(false); documentationScrollPane.setViewportView(documentationEditor); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.fill = GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; documentationPanel.add(documentationScrollPane, gridBagConstraints); tabPane.addTab("Documentation", documentationPanel); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER; gridBagConstraints.gridheight = GridBagConstraints.REMAINDER; gridBagConstraints.fill = GridBagConstraints.BOTH; gridBagConstraints.weighty = 1.0; mainPanel.add(tabPane, gridBagConstraints); frame.getContentPane().add(mainPanel, BorderLayout.CENTER); frame.pack(); }