List of usage examples for javax.swing SwingConstants RIGHT
int RIGHT
To view the source code for javax.swing SwingConstants RIGHT.
Click Source Link
From source file:davmail.ui.SettingsFrame.java
protected void addPortSettingComponent(JPanel panel, String label, JComponent component, JComponent checkboxComponent, JComponent checkboxSSLComponent, String toolTipText) { JLabel fieldLabel = new JLabel(label); fieldLabel.setHorizontalAlignment(SwingConstants.RIGHT); fieldLabel.setVerticalAlignment(SwingConstants.CENTER); panel.add(fieldLabel);//from w w w . ja v a2 s. c om component.setMaximumSize(component.getPreferredSize()); JPanel innerPanel = new JPanel(); innerPanel.setLayout(new BoxLayout(innerPanel, BoxLayout.X_AXIS)); innerPanel.add(checkboxComponent); innerPanel.add(component); innerPanel.add(checkboxSSLComponent); panel.add(innerPanel); if (toolTipText != null) { fieldLabel.setToolTipText(toolTipText); component.setToolTipText(toolTipText); } }
From source file:com.sec.ose.osi.ui.dialog.setting.JPanReportProperty.java
/** * This method initializes jPanelValue * /*from www.ja va2 s . c o m*/ * @return javax.swing.JPanel */ private JPanel getJPanelValue() { if (jPanelValue == null) { jPanelValue = new JPanel(); jPanelValue.setLayout(new GridBagLayout()); jPanelValue.setBorder(BorderFactory.createTitledBorder(null, "", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("Dialog", Font.BOLD, 12), new Color(51, 51, 51))); jPanelValue.setPreferredSize(new Dimension(400, 200)); // Default Report Location jLabelDefaultReportLocation = new JLabel(); jLabelDefaultReportLocation.setText("Default Report Location:"); jLabelDefaultReportLocation.setHorizontalAlignment(SwingConstants.RIGHT); GridBagConstraints gridBagConstraintsjLabelDefaultReportLocation = new GridBagConstraints(); gridBagConstraintsjLabelDefaultReportLocation.gridx = 0; gridBagConstraintsjLabelDefaultReportLocation.fill = GridBagConstraints.HORIZONTAL; gridBagConstraintsjLabelDefaultReportLocation.insets = new Insets(5, 0, 0, 0); gridBagConstraintsjLabelDefaultReportLocation.gridy = 1; GridBagConstraints gridBagConstraintsjpanelDefaultReportLocation = new GridBagConstraints(); gridBagConstraintsjpanelDefaultReportLocation.fill = GridBagConstraints.BOTH; gridBagConstraintsjpanelDefaultReportLocation.gridy = 1; gridBagConstraintsjpanelDefaultReportLocation.weightx = 1.0; gridBagConstraintsjpanelDefaultReportLocation.insets = new Insets(10, 5, 5, 15); gridBagConstraintsjpanelDefaultReportLocation.gridx = 1; // reciprocal license jLabelReciprocalLicense = new JLabel(); jLabelReciprocalLicense.setText("Reciprocal License (RED):"); jLabelReciprocalLicense.setHorizontalAlignment(SwingConstants.RIGHT); GridBagConstraints gridBagConstraintsjLabelReciprocalLicense = new GridBagConstraints(); gridBagConstraintsjLabelReciprocalLicense.gridx = 0; gridBagConstraintsjLabelReciprocalLicense.insets = new Insets(0, 15, 0, 0); gridBagConstraintsjLabelReciprocalLicense.fill = GridBagConstraints.HORIZONTAL; gridBagConstraintsjLabelReciprocalLicense.gridy = 2; jPanelValue.add(jLabelDefaultReportLocation, gridBagConstraintsjLabelDefaultReportLocation); jPanelValue.add(getJPanelDefaultReportLocation(), gridBagConstraintsjpanelDefaultReportLocation); jPanelValue.add(jLabelReciprocalLicense, gridBagConstraintsjLabelReciprocalLicense); GridBagConstraints gridBagConstraintsgetJTextFieldReciprocalLicense = new GridBagConstraints(); gridBagConstraintsgetJTextFieldReciprocalLicense.gridx = 1; gridBagConstraintsgetJTextFieldReciprocalLicense.weightx = 1.0; gridBagConstraintsgetJTextFieldReciprocalLicense.fill = GridBagConstraints.BOTH; gridBagConstraintsgetJTextFieldReciprocalLicense.insets = new Insets(5, 5, 5, 15); gridBagConstraintsgetJTextFieldReciprocalLicense.gridy = 2; jPanelValue.add(getJTextFieldReciprocalLicense(), gridBagConstraintsgetJTextFieldReciprocalLicense); // major license jLabelMajorLicense = new JLabel(); jLabelMajorLicense.setText("Major License (ORANGE):"); jLabelMajorLicense.setHorizontalAlignment(SwingConstants.RIGHT); GridBagConstraints gridBagConstraintsjLabelMajorLicense = new GridBagConstraints(); gridBagConstraintsjLabelMajorLicense.gridx = 0; gridBagConstraintsjLabelMajorLicense.insets = new Insets(0, 15, 0, 0); gridBagConstraintsjLabelMajorLicense.fill = GridBagConstraints.HORIZONTAL; gridBagConstraintsjLabelMajorLicense.gridy = 3; jPanelValue.add(jLabelMajorLicense, gridBagConstraintsjLabelMajorLicense); GridBagConstraints gridBagConstraintsgetJTextFieldMajorLicense = new GridBagConstraints(); gridBagConstraintsgetJTextFieldMajorLicense.gridx = 1; gridBagConstraintsgetJTextFieldMajorLicense.weightx = 1.0; gridBagConstraintsgetJTextFieldMajorLicense.fill = GridBagConstraints.BOTH; gridBagConstraintsgetJTextFieldMajorLicense.insets = new Insets(5, 5, 5, 15); gridBagConstraintsgetJTextFieldMajorLicense.gridy = 3; jPanelValue.add(getJTextFieldMajorLicense(), gridBagConstraintsgetJTextFieldMajorLicense); GridBagConstraints gridBagConstraints3 = new GridBagConstraints(); gridBagConstraints3.gridx = 1; gridBagConstraints3.weighty = 1.0; gridBagConstraints3.weightx = 0.0; gridBagConstraints3.gridy = 4; JLabel jLabelEmpty = new JLabel(); jLabelEmpty.setText(""); jPanelValue.add(jLabelEmpty, gridBagConstraints3); } return jPanelValue; }
From source file:com.jbombardier.console.charts.XYTimeChartPanel.java
public XYTimeChartPanel() { DateAxis numberaxis = new DateAxis("Time"); yAxis = new NumberAxis("Count"); yAxis.setAutoRangeIncludesZero(true); XYSplineRenderer renderer = new XYSplineRenderer(); // XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); xyplot = new XYPlot(xyseriescollection, numberaxis, yAxis, renderer); xyplot.setBackgroundPaint(Color.white); xyplot.setDomainGridlinePaint(Color.lightGray); xyplot.setRangeGridlinePaint(Color.lightGray); // xyplot.setAxisOffset(new RectangleInsets(4D, 4D, 4D, 4D)); // XYLineAndShapeRenderer xylineandshaperenderer = (XYLineAndShapeRenderer) // xyplot.getRenderer(); // xylineandshaperenderer.setBaseShapesVisible(false); // xylineandshaperenderer.setBaseShapesFilled(false); chart = new JFreeChart("Running threads", JFreeChart.DEFAULT_TITLE_FONT, xyplot, true); /*/* w w w .j a v a2 s . c o m*/ * ValueMarker valuemarker1 = new ValueMarker(175D); * valuemarker1.setLabelOffsetType(LengthAdjustmentType.EXPAND); * valuemarker1.setPaint(Color.red); valuemarker1.setLabel("Target Price"); * valuemarker1.setLabelAnchor(RectangleAnchor.TOP_RIGHT); * valuemarker1.setLabelTextAnchor(TextAnchor.BOTTOM_RIGHT); * xyplot.addRangeMarker(valuemarker1); */ LegendTitle legend = chart.getLegend(); legend.setPosition(RectangleEdge.RIGHT); // ChartUtilities.applyCurrentTheme(chart); setLayout(new BorderLayout()); jFreeChartPanel = new ChartPanel(chart); jFreeChartPanel.setMinimumDrawHeight(0); jFreeChartPanel.setMinimumDrawWidth(0); jFreeChartPanel.setMaximumDrawHeight(Integer.MAX_VALUE); jFreeChartPanel.setMaximumDrawWidth(Integer.MAX_VALUE); add(jFreeChartPanel, BorderLayout.CENTER); JPanel controls = new JPanel(new MigLayout("gap 0, ins 0", "[grow,center,fill]", "[grow,center]")); final JCheckBox checkbox = new JCheckBox("Auto-scale"); checkbox.setSelected(true); checkbox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { toggleAutoscroll(checkbox.isSelected()); } }); checkbox.setHorizontalAlignment(SwingConstants.RIGHT); controls.add(checkbox, "cell 0 0,alignx center"); add(controls, BorderLayout.SOUTH); }
From source file:com.compomics.pladipus.controller.setup.InstallPladipus.java
/** * Queries the user for the valid user login and password * * @throws IOException//from w ww .j a v a 2 s . c o m */ public boolean validateUser() throws IOException { JPanel panel = new JPanel(new BorderLayout(5, 5)); JPanel label = new JPanel(new GridLayout(0, 1, 2, 2)); label.add(new JLabel("Username", SwingConstants.RIGHT)); label.add(new JLabel("Password", SwingConstants.RIGHT)); panel.add(label, BorderLayout.WEST); JPanel controls = new JPanel(new GridLayout(0, 1, 2, 2)); JTextField username = new JTextField(); controls.add(username); JPasswordField password = new JPasswordField(); controls.add(password); panel.add(controls, BorderLayout.CENTER); int showConfirmDialog = JOptionPane.showConfirmDialog(null, panel, "Pladipus Login", JOptionPane.OK_CANCEL_OPTION); if (showConfirmDialog == JOptionPane.CANCEL_OPTION) { return false; } String user = username.getText(); String pass = new String(password.getPassword()); if (login(user, pass)) { writeWorkerBash(user, pass); return true; } else { throw new SecurityException("User credentials are incorrect!"); } }
From source file:de.tbuchloh.kiskis.gui.widgets.PasswordElement.java
/** * @param pwd/*from ww w .j a va2 s.c om*/ * the password to edit */ public PasswordElement(final char[] pwd) { _pwdField = new JPasswordField(new String(pwd)); _pwdField.setFont(createFont()); _pwdField.getDocument().addDocumentListener(new DocumentListener() { @Override public void changedUpdate(final DocumentEvent e) { notifyListeners(); } @Override public void insertUpdate(final DocumentEvent e) { notifyListeners(); } @Override public void removeUpdate(final DocumentEvent e) { notifyListeners(); } }); _pwdButton = new LinkLabel(M.createAction(this, "onShowPassword")); _pwdButton.setHorizontalAlignment(SwingConstants.RIGHT); _testButton = new LinkLabel(M.createAction(this, "onTestPassword")); _testButton.setHorizontalAlignment(SwingConstants.RIGHT); _mode = HIDDEN; _progressBar = new PasswordQualityBar(); _progressBar.setSmallFont(); init(); initCreatePopup(); }
From source file:com.josescalia.tumblr.app.MainFrame.java
/** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor./* ww w .ja va2 s . co m*/ */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { bindingGroup = new org.jdesktop.beansbinding.BindingGroup(); jMenuItem1 = new javax.swing.JMenuItem(); jMenuItem2 = new javax.swing.JMenuItem(); mainPanel = new javax.swing.JPanel(); jPanel1 = new javax.swing.JPanel(); lblDate = new javax.swing.JLabel(); progressBar = new javax.swing.JProgressBar(); lblTime = new javax.swing.JLabel(); lblMark = new javax.swing.JLabel(); jMenuBar1 = new javax.swing.JMenuBar(); jMenu3 = new javax.swing.JMenu(); mnTumblrImageViewer = new javax.swing.JMenuItem(); jMenu1 = new javax.swing.JMenu(); mnTumblrFavList = new javax.swing.JMenuItem(); jMenu2 = new javax.swing.JMenu(); mnConfiguration = new javax.swing.JMenuItem(); mnHelp = new javax.swing.JMenuItem(); jSeparator1 = new javax.swing.JPopupMenu.Separator(); mnExit = new javax.swing.JMenuItem(); jMenuItem1.setText("jMenuItem1"); jMenuItem2.setText("jMenuItem2"); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setIconImage(new ImageIcon(getClass().getResource("/icons/tumblr.png")).getImage()); setPreferredSize(new java.awt.Dimension(1360, 700)); mainPanel.setBorder(javax.swing.BorderFactory.createEtchedBorder()); javax.swing.GroupLayout mainPanelLayout = new javax.swing.GroupLayout(mainPanel); mainPanel.setLayout(mainPanelLayout); mainPanelLayout.setHorizontalGroup(mainPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 0, Short.MAX_VALUE)); mainPanelLayout.setVerticalGroup(mainPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 652, Short.MAX_VALUE)); jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder()); lblDate.setFont(new java.awt.Font("Dialog", 0, 10)); // NOI18N org.jdesktop.beansbinding.Binding binding = org.jdesktop.beansbinding.Bindings.createAutoBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${currentDate}"), lblDate, org.jdesktop.beansbinding.BeanProperty.create("text")); bindingGroup.addBinding(binding); progressBar.setString(""); progressBar.setStringPainted(true); lblTime.setFont(new java.awt.Font("Dialog", 0, 10)); // NOI18N binding = org.jdesktop.beansbinding.Bindings.createAutoBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${currentTime}"), lblTime, org.jdesktop.beansbinding.BeanProperty.create("text")); bindingGroup.addBinding(binding); lblMark.setFont(new java.awt.Font("Dialog", 0, 10)); // NOI18N lblMark.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); lblMark.setToolTipText(""); binding = org.jdesktop.beansbinding.Bindings.createAutoBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${lblFooter}"), lblMark, org.jdesktop.beansbinding.BeanProperty.create("text")); bindingGroup.addBinding(binding); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup(jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup().addContainerGap() .addComponent(progressBar, javax.swing.GroupLayout.PREFERRED_SIZE, 175, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(lblDate, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(lblTime, javax.swing.GroupLayout.PREFERRED_SIZE, 109, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 690, Short.MAX_VALUE) .addComponent(lblMark, javax.swing.GroupLayout.PREFERRED_SIZE, 234, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap())); jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup().addGap(1, 1, 1).addGroup(jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(lblDate, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(progressBar, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(lblTime, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(lblMark, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(3, 3, 3))); jMenu3.setText("Tumblr"); mnTumblrImageViewer.setText("Tumblr Image Viewer"); mnTumblrImageViewer.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { mnTumblrImageViewerActionPerformed(evt); } }); jMenu3.add(mnTumblrImageViewer); jMenuBar1.add(jMenu3); jMenu1.setText("Favorite"); mnTumblrFavList.setText("Tumblr Rss Fav List"); mnTumblrFavList.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { mnTumblrFavListActionPerformed(evt); } }); jMenu1.add(mnTumblrFavList); jMenuBar1.add(jMenu1); jMenu2.setText("System"); mnConfiguration.setText("Configuration"); mnConfiguration.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { mnConfigurationActionPerformed(evt); } }); jMenu2.add(mnConfiguration); mnHelp.setText("Help"); mnHelp.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { mnHelpActionPerformed(evt); } }); jMenu2.add(mnHelp); jMenu2.add(jSeparator1); mnExit.setText("Exit"); mnExit.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { mnExitActionPerformed(evt); } }); jMenu2.add(mnExit); jMenuBar1.add(jMenu2); setJMenuBar(jMenuBar1); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup().addGap(1, 1, 1) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(mainPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))); layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(mainPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGap(1, 1, 1).addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))); bindingGroup.bind(); pack(); }
From source file:com.sec.ose.osi.ui.frm.login.JPanLogin.java
/** * This method initializes jPanelUserInfo * /*from www . j a v a 2 s . c o m*/ * @return javax.swing.JPanel */ private JPanel getJPanelUserInfo() { if (jPanelUserInfo == null) { jPanelUserInfo = new JPanel(); jPanelUserInfo.setLayout(new GridBagLayout()); // User ID JLabel jLabelUser = new JLabel("User ID:"); jLabelUser.setHorizontalAlignment(SwingConstants.RIGHT); jLabelUser.setText("User ID :"); jLabelUser.setEnabled(true); GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridy = 0; gridBagConstraints.gridx = 0; gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints.insets = new Insets(0, 10, 0, 0); jPanelUserInfo.add(jLabelUser, gridBagConstraints); GridBagConstraints gridBagConstraints1 = new GridBagConstraints(); gridBagConstraints1.fill = GridBagConstraints.BOTH; gridBagConstraints1.gridy = 0; gridBagConstraints1.gridx = 1; gridBagConstraints1.weightx = 1.0; gridBagConstraints1.insets = new Insets(5, 5, 5, 5); jPanelUserInfo.add(getJTextFieldUser(), gridBagConstraints1); // Password JLabel jLabelPwd = new JLabel(); jLabelPwd.setText("Password :"); jLabelPwd.setHorizontalAlignment(SwingConstants.RIGHT); GridBagConstraints gridBagConstraints2 = new GridBagConstraints(); gridBagConstraints2.gridy = 1; gridBagConstraints2.gridx = 0; gridBagConstraints2.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints2.insets = new Insets(0, 10, 0, 0); jPanelUserInfo.add(jLabelPwd, gridBagConstraints2); GridBagConstraints gridBagConstraints3 = new GridBagConstraints(); gridBagConstraints3.fill = GridBagConstraints.BOTH; gridBagConstraints3.gridy = 1; gridBagConstraints3.gridx = 1; gridBagConstraints3.weightx = 1.0; gridBagConstraints3.insets = new Insets(5, 5, 5, 5); jPanelUserInfo.add(getJPasswordField(), gridBagConstraints3); // Protex Server IP JLabel jLabelServer = new JLabel(); jLabelServer.setText("Protex Server IP :"); jLabelServer.setHorizontalAlignment(SwingConstants.RIGHT); jLabelServer.setDisplayedMnemonic(KeyEvent.VK_UNDEFINED); GridBagConstraints gridBagConstraints11 = new GridBagConstraints(); gridBagConstraints11.gridy = 2; gridBagConstraints11.gridx = 0; gridBagConstraints11.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints11.insets = new Insets(0, 10, 5, 0); jPanelUserInfo.add(jLabelServer, gridBagConstraints11); GridBagConstraints gridBagConstraints21 = new GridBagConstraints(); gridBagConstraints21.gridy = 2; gridBagConstraints21.gridx = 1; gridBagConstraints21.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints21.insets = new Insets(5, 5, 10, 5); jPanelUserInfo.add(getJTextFieldServerIP(), gridBagConstraints21); } return jPanelUserInfo; }
From source file:com.willwinder.universalgcodesender.uielements.panels.MachineStatusPanel.java
private void applyFont() { String fontPath = "/resources/"; String fontName = "LED.ttf"; InputStream is = getClass().getResourceAsStream(fontPath + fontName); Font font;// www. j a va 2 s .c om Font big, small; try { font = Font.createFont(Font.TRUETYPE_FONT, is); big = font.deriveFont(Font.PLAIN, 30); small = font.deriveFont(Font.PLAIN, 18); } catch (Exception ex) { ex.printStackTrace(); System.err.println(fontName + " not loaded. Using serif font."); big = new Font("serif", Font.PLAIN, 24); small = new Font("serif", Font.PLAIN, 17); } GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); ge.registerFont(big); ge.registerFont(small); this.machinePositionXValue.setFont(small); this.machinePositionXValue.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); this.machinePositionYValue.setFont(small); this.machinePositionYValue.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); this.machinePositionZValue.setFont(small); this.machinePositionZValue.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); this.workPositionXValue.setFont(big); this.workPositionXValue.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); this.workPositionYValue.setFont(big); this.workPositionYValue.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); this.workPositionZValue.setFont(big); this.workPositionZValue.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); }
From source file:edu.ku.brc.specify.config.init.secwiz.DatabasePanel.java
/** * Creates a dialog for entering database name and selecting the appropriate driver. *//*ww w .j a v a2 s.com*/ public DatabasePanel(final JButton nextBtn, final JButton prevBtn, final String helpContext, final boolean doSetDefaultValues) { super("DATABASE", helpContext, nextBtn, prevBtn); this.doSetDefaultValues = doSetDefaultValues; String header = getResourceString("ENTER_DB_INFO") + ":"; CellConstraints cc = new CellConstraints(); String rowDef = "p,2px," + UIHelper.createDuplicateJGoodiesDef("p", "2px", isMobile() ? 5 : 4) + ",10px,p,10px,p,4px,p,4px,p,10px,f:p:g"; 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; if (isMobile()) { dbNameTxt = createField(builder, "DB_NAME", true, row); row += 2; } else { dbNameTxt = createTextField(); } hostNameTxt = createField(builder, "HOST_NAME", true, row); row += 2; driverList = DatabaseDriverInfo.getDriversList(); drivers = 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; label = UIHelper.createLabel("", SwingConstants.CENTER); PanelBuilder panelPB = new PanelBuilder(new FormLayout("f:p:g", "20px,p,8px,p")); panelPB.add(getProgressBar(), cc.xy(1, 2)); panelPB.add(label, cc.xy(1, 4)); builder.add(panelPB.getPanel(), cc.xy(3, row)); row += 2; //panelPB.getPanel().setBackground(Color.RED); //setBackground(Color.GREEN); // Advance part of pane advLabel = UIHelper.createI18NLabel("SEC_ADV_MU_DESC", SwingConstants.CENTER); skipStepBtn = UIHelper.createI18NButton("ADV_DB_TEST"); builder.add(advLabel, cc.xyw(3, row, 1)); row += 2; PanelBuilder 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; JComponent helpComponent = createHelpPanel(getBackground(), "database"); builder.add(helpComponent, cc.xyw(3, row, 1)); row += 2; skipStepBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { skipStepBtn.setEnabled(false); boolean ok = skipDBCreate(); if (ok) { ok = checkForPermissions(); } isOK = ok; skipStepBtn.setEnabled(true); advLabel.setText(getResourceString(ok ? "ADV_DB_OK" : "ADV_DB_ERR")); advLabel.setForeground(ok ? Color.BLACK : Color.RED); nextBtn.setEnabled(isOK); } }); if (isMobile()) { skipStepBtn.setVisible(false); advLabel.setVisible(false); } progressBar.setVisible(false); updateBtnUI(); }
From source file:gda.gui.beans.BeanBase.java
protected JLabel getLblLabel() { if (lblLabel == null) { lblLabel = new JLabel(); lblLabel.setText("Name"); lblLabel.setHorizontalAlignment(SwingConstants.RIGHT); lblLabel.setHorizontalTextPosition(SwingConstants.RIGHT); }//w ww . j a v a 2 s . c o m return lblLabel; }