List of usage examples for javax.swing JLabel setHorizontalAlignment
@BeanProperty(visualUpdate = true, enumerationValues = { "SwingConstants.LEFT", "SwingConstants.CENTER", "SwingConstants.RIGHT", "SwingConstants.LEADING", "SwingConstants.TRAILING" }, description = "The alignment of the label's content along the X axis.") public void setHorizontalAlignment(int alignment)
From source file:gov.nih.nci.nbia.StandaloneDMV3.java
JFrame showProgressForMac(String message) { JFrame f = new JFrame("Info"); f.setUndecorated(true);/*from w ww. j av a 2 s . c o m*/ JPanel p = new JPanel(); p.setLayout(new BorderLayout()); JLabel waitInfo = new JLabel("Loading your data..."); waitInfo.setForeground(new Color(105, 105, 105)); waitInfo.setFont(new Font("Tahoma", Font.BOLD, 13)); waitInfo.setHorizontalAlignment(JLabel.CENTER); waitInfo.setVerticalAlignment(JLabel.CENTER); p.add(waitInfo, BorderLayout.CENTER); f.getContentPane().add(p); f.setSize(360, 40); f.setLocationRelativeTo(null); f.setVisible(true); return f; }
From source file:davmail.ui.SettingsFrame.java
protected void addSettingComponent(JPanel panel, String label, JComponent component, String toolTipText) { JLabel fieldLabel = new JLabel(label); fieldLabel.setHorizontalAlignment(SwingConstants.RIGHT); fieldLabel.setVerticalAlignment(SwingConstants.CENTER); panel.add(fieldLabel);/* w w w . j a v a 2s. c om*/ component.setMaximumSize(component.getPreferredSize()); JPanel innerPanel = new JPanel(); innerPanel.setLayout(new BoxLayout(innerPanel, BoxLayout.X_AXIS)); innerPanel.add(component); panel.add(innerPanel); if (toolTipText != null) { fieldLabel.setToolTipText(toolTipText); component.setToolTipText(toolTipText); } }
From source file:com.floreantpos.ui.views.payment.GroupSettleTicketDialog.java
private JPanel createTotalViewerPanel() { JLabel lblSubtotal = new javax.swing.JLabel(); lblSubtotal.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); lblSubtotal.setText(com.floreantpos.POSConstants.SUBTOTAL + ":" + " " + CurrencyUtil.getCurrencySymbol()); //$NON-NLS-1$ //$NON-NLS-2$ tfSubtotal = new javax.swing.JTextField(10); tfSubtotal.setHorizontalAlignment(SwingConstants.TRAILING); tfSubtotal.setEditable(false);// w ww . j a v a2s.com JLabel lblDiscount = new javax.swing.JLabel(); lblDiscount.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); lblDiscount.setText(Messages.getString("TicketView.9") + " " + CurrencyUtil.getCurrencySymbol()); //$NON-NLS-1$ //$NON-NLS-2$ tfDiscount = new javax.swing.JTextField(10); tfDiscount.setHorizontalAlignment(SwingConstants.TRAILING); tfDiscount.setEditable(false); JLabel lblDeliveryCharge = new javax.swing.JLabel(); lblDeliveryCharge.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); lblDeliveryCharge.setText("Delivery Charge:" + " " + CurrencyUtil.getCurrencySymbol()); //$NON-NLS-1$ //$NON-NLS-2$ tfDeliveryCharge = new JTextField(10); tfDeliveryCharge.setHorizontalAlignment(SwingConstants.TRAILING); tfDeliveryCharge.setEditable(false); JLabel lblTax = new javax.swing.JLabel(); lblTax.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); lblTax.setText(com.floreantpos.POSConstants.TAX + ":" + " " + CurrencyUtil.getCurrencySymbol()); //$NON-NLS-1$ //$NON-NLS-2$ tfTax = new javax.swing.JTextField(); tfTax.setEditable(false); tfTax.setHorizontalAlignment(SwingConstants.TRAILING); JLabel lblGratuity = new javax.swing.JLabel(); lblGratuity.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); lblGratuity .setText(Messages.getString("SettleTicketDialog.5") + ":" + " " + CurrencyUtil.getCurrencySymbol()); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ tfGratuity = new javax.swing.JTextField(); tfGratuity.setEditable(false); tfGratuity.setHorizontalAlignment(SwingConstants.TRAILING); JLabel lblTotal = new javax.swing.JLabel(); lblTotal.setFont(lblTotal.getFont().deriveFont(Font.BOLD, 18)); lblTotal.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); lblTotal.setText(com.floreantpos.POSConstants.TOTAL + ":" + " " + CurrencyUtil.getCurrencySymbol()); //$NON-NLS-1$ //$NON-NLS-2$ tfTotal = new javax.swing.JTextField(10); tfTotal.setFont(tfTotal.getFont().deriveFont(Font.BOLD, 18)); tfTotal.setHorizontalAlignment(SwingConstants.TRAILING); tfTotal.setEditable(false); JPanel ticketAmountPanel = new com.floreantpos.swing.TransparentPanel( new MigLayout("hidemode 3,ins 2 2 3 2,alignx trailing,fill", "[grow][]", "")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ ticketAmountPanel.add(lblSubtotal, "growx,aligny center"); //$NON-NLS-1$ ticketAmountPanel.add(tfSubtotal, "growx,aligny center"); //$NON-NLS-1$ ticketAmountPanel.add(lblDiscount, "newline,growx,aligny center"); //$NON-NLS-1$ //$NON-NLS-2$ ticketAmountPanel.add(tfDiscount, "growx,aligny center"); //$NON-NLS-1$ ticketAmountPanel.add(lblTax, "newline,growx,aligny center"); //$NON-NLS-1$ ticketAmountPanel.add(tfTax, "growx,aligny center"); //$NON-NLS-1$ ticketAmountPanel.add(lblDeliveryCharge, "newline,growx,aligny center"); //$NON-NLS-1$ ticketAmountPanel.add(tfDeliveryCharge, "growx,aligny center"); //$NON-NLS-1$ ticketAmountPanel.add(lblGratuity, "newline,growx,aligny center"); //$NON-NLS-1$ ticketAmountPanel.add(tfGratuity, "growx,aligny center"); //$NON-NLS-1$ ticketAmountPanel.add(lblTotal, "newline,growx,aligny center"); //$NON-NLS-1$ ticketAmountPanel.add(tfTotal, "growx,aligny center"); //$NON-NLS-1$ return ticketAmountPanel; }
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);//w w w. j a v a2 s. c o m 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.diversityarrays.kdxplore.heatmap.AskForPositionNamesAndTraitInstancePanel.java
public AskForPositionNamesAndTraitInstancePanel(int nPositionsWanted, int nTraitInstancesWanted, List<ValueRetriever<?>> positionAndPlotRetrievers, Map<TraitInstance, SimpleStatistics<?>> statsByTraitInstance, final Closure<Boolean> enableActionNotifier, CurationContext context) { super(new BorderLayout()); if (nPositionsWanted > 3) { // coz we only do X,Y,Z !! throw new IllegalArgumentException("At most 3 position names can be chosen"); }/*from ww w . ja v a 2 s. co m*/ nPositionNamesToChoose = nPositionsWanted; nTraitInstancesToChoose = nTraitInstancesWanted; this.enableActionNotifier = enableActionNotifier; // this.traitInstanceIsAvailable = traitInstanceIsAvailable; this.statsByTraitInstance = statsByTraitInstance; traitInstancesX = new ArrayList<TraitInstance>(statsByTraitInstance.keySet()); Collections.sort(traitInstancesX, TraitHelper.COMPARATOR); List<ValueRetriever<?>> list = new ArrayList<ValueRetriever<?>>(); list.addAll(positionAndPlotRetrievers); Function<TraitInstance, List<KdxSample>> sampleProvider = new Function<TraitInstance, List<KdxSample>>() { @Override public List<KdxSample> apply(TraitInstance ti) { return context.getPlotInfoProvider().getSampleMeasurements(ti); } }; for (TraitInstance ti : traitInstancesX) { try { ValidationRule vrule = ValidationRule.create(ti.trait.getTraitValRule()); validationRuleByTraitInstance.put(ti, vrule); TraitInstanceValueRetriever<?> tivr = TraitInstanceValueRetriever .getValueRetriever(context.getTrial(), ti, sampleProvider); list.add(tivr); } catch (InvalidRuleException e) { validationRuleExceptionByTraitInstance.put(ti, e); } } tableModel.initialise(list); Box buttons = Box.createVerticalBox(); final List<AxisChoiceAction> axisChoiceActions = new ArrayList<>(); for (AxisChoice ac : AxisChoice.values()) { AxisChoiceAction action = new AxisChoiceAction(ac); action.setEnabled(false); axisChoiceActions.add(action); } buttons.add(new JLabel("Select Axis:")); for (AxisChoiceAction action : axisChoiceActions) { if (AxisChoice.Z == action.axisChoice) { buttons.add(Box.createVerticalStrut(10)); } buttons.add(new JButton(action)); if (AxisChoice.NOT_SELECTED == action.axisChoice) { buttons.add(Box.createVerticalStrut(10)); } } buttons.add(Box.createVerticalGlue()); table.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { int mrow = -1; int vrow = table.getSelectedRow(); if (vrow >= 0) { mrow = table.convertRowIndexToModel(vrow); } if (mrow >= 0) { ValueRetriever<?> vr = tableModel.valueRetrievers.get(mrow); boolean isTraitInstance = vr instanceof TraitInstanceValueRetriever; for (AxisChoiceAction action : axisChoiceActions) { switch (action.axisChoice) { case NOT_SELECTED: case X: case Y: action.setEnabled(true); break; case Z: action.setEnabled(isTraitInstance); break; default: action.setEnabled(false); break; } } } else { for (AxisChoiceAction action : axisChoiceActions) { action.setEnabled(false); } } } } }); table.setDefaultRenderer(AxisChoice.class, new AxisChoiceRenderer("Not available", "*")); table.setDefaultRenderer(TraitInstance.class, new TraitInstanceRenderer()); String text = nTraitInstancesToChoose <= 1 ? "Select Axes and Value:" : "Select Axes and Values:"; JPanel traitInstancesPanel = new JPanel(new BorderLayout()); traitInstancesPanel.setBorder(new EmptyBorder(0, 10, 0, 0)); traitInstancesPanel.add(new JLabel(text), BorderLayout.NORTH); traitInstancesPanel.add(new JScrollPane(table), BorderLayout.CENTER); add(buttons, BorderLayout.WEST); add(traitInstancesPanel, BorderLayout.CENTER); if (!tableModel.excluded.isEmpty()) { JLabel lbl = new JLabel("TraitInstances without plottable data have been excluded"); lbl.setHorizontalAlignment(JLabel.CENTER); add(lbl, BorderLayout.SOUTH); // StringBuilder sb = new StringBuilder("<HTML>No Data:"); // for (ValueRetriever<?> vr : tableModel.excluded) { // sb.append("<BR>").append(StringUtil.htmlEscape(vr.getDisplayName())); // } // add(new JScrollPane(new JLabel(sb.toString())), BorderLayout.SOUTH); } }
From source file:com.openbravo.pos.sales.JRetailTicketPreviewTicket.java
private JPanel getLabelPanel(String msg, Color colour) { JPanel panel = new JPanel(); Font font = new Font("Verdana", Font.BOLD, 12); panel.setFont(font);// www. j a v a2 s.com panel.setOpaque(true); // panel.setBackground(Color.BLUE); JLabel label = new JLabel(msg, JLabel.LEFT); label.setForeground(colour); label.setHorizontalAlignment(javax.swing.SwingConstants.LEFT); panel.add(label); return panel; }
From source file:dk.dma.epd.common.prototype.gui.notification.ChatServicePanel.java
/** * Updates the chat message panel in the Swing event thread */// w w w . j a va 2s. co m public void updateChatMessagePanel() { // Ensure that we operate in the Swing event thread if (!SwingUtilities.isEventDispatchThread()) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { updateChatMessagePanel(); } }); return; } // Set the title header titleHeader.setText(chatData != null ? NameUtils.getName(chatData.getId(), NameFormat.MEDIUM) : " "); titleHeader.setVisible(chatData != null); // Only enable send-function when there is chat data, and hence a target sendBtn.setEnabled(chatData != null); messageText.setEditable(chatData != null); // Remove all components from the messages panel messagesPanel.removeAll(); Insets insets = new Insets(0, 2, 2, 2); Insets insets2 = new Insets(6, 2, 0, 2); if (chatData != null && chatData.getMessageCount() > 0) { // First, add a filler component int y = 0; messagesPanel.add(new JLabel(""), new GridBagConstraints(0, y++, 1, 1, 0.0, 1.0, NORTH, VERTICAL, insets, 0, 0)); // Add the messages long lastMessageTime = 0; for (EPDChatMessage message : chatData.getMessages()) { // Check if we need to add a time label if (message.getSendDate().getTime() - lastMessageTime > PRINT_DATE_INTERVAL) { JLabel dateLabel = new JLabel( String.format(message.isOwnMessage() ? "Sent to %s" : "Received %s", Formatter.formatShortDateTimeNoTz(new Date(message.getSendDate().getTime())))); dateLabel.setFont(dateLabel.getFont().deriveFont(9.0f).deriveFont(Font.PLAIN)); dateLabel.setHorizontalAlignment(SwingConstants.CENTER); dateLabel.setForeground(Color.LIGHT_GRAY); messagesPanel.add(dateLabel, new GridBagConstraints(0, y++, 1, 1, 1.0, 0.0, NORTH, HORIZONTAL, insets2, 0, 0)); } // Add a chat message field JPanel msg = new JPanel(); msg.setBorder(new ChatMessageBorder(message)); JLabel msgLabel = new ChatMessageLabel(message.getMsg(), message.isOwnMessage()); msg.add(msgLabel); messagesPanel.add(msg, new GridBagConstraints(0, y++, 1, 1, 1.0, 0.0, NORTH, HORIZONTAL, insets, 0, 0)); lastMessageTime = message.getSendDate().getTime(); } // Scroll to the bottom validate(); scrollPane.getVerticalScrollBar().setValue(scrollPane.getVerticalScrollBar().getMaximum()); messagesPanel.repaint(); } else if (chatData == null && noDataComponent != null) { // The noDataComponent may e.g. be a message messagesPanel.add(noDataComponent, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, NORTH, BOTH, insets, 0, 0)); } }
From source file:drusy.ui.panels.SwitchStatePanel.java
private void addUser(String hostName, String information, long txBytes, long rxBytes) { JPanel panel = new JPanel(); JLabel informationLabel = new JLabel(); ImageIcon imageIcon;//from www . java 2s . c o m //======== panel1 ======== { panel.setLayout(new BorderLayout()); panel.setBorder(new EmptyBorder(0, 10, 0, 10)); //---- label2 ---- if (hostName.equals("smartphone")) { imageIcon = Res.getImage("img/iphone-56.png"); } else { imageIcon = Res.getImage("img/mac-56.png"); } informationLabel.setIcon(imageIcon); informationLabel.setText("<html><b>" + information + "</b><br />Download: " + txBytes / 1000.0 + " ko/s <br />Upload: " + rxBytes / 1000.0 + " ko/s</html>"); informationLabel.setHorizontalAlignment(SwingConstants.CENTER); panel.add(informationLabel, BorderLayout.CENTER); } mainPanel.add(panel); adaptPanelSize(); users.add(panel); }
From source file:com.floreantpos.ui.views.payment.SettleTicketDialog.java
private JPanel createTotalViewerPanel() { JLabel lblSubtotal = new javax.swing.JLabel(); lblSubtotal.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); lblSubtotal.setText(com.floreantpos.POSConstants.SUBTOTAL + ":" + " " + CurrencyUtil.getCurrencySymbol()); //$NON-NLS-1$ //$NON-NLS-2$ tfSubtotal = new javax.swing.JTextField(10); tfSubtotal.setHorizontalAlignment(SwingConstants.TRAILING); tfSubtotal.setEditable(false);/* ww w . j av a 2 s . c o m*/ JLabel lblDiscount = new javax.swing.JLabel(); lblDiscount.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); lblDiscount.setText(Messages.getString("TicketView.9") + " " + CurrencyUtil.getCurrencySymbol()); //$NON-NLS-1$ //$NON-NLS-2$ tfDiscount = new javax.swing.JTextField(10); // tfDiscount.setFont(tfDiscount.getFont().deriveFont(Font.PLAIN, 16)); tfDiscount.setHorizontalAlignment(SwingConstants.TRAILING); tfDiscount.setEditable(false); tfDiscount.setText(ticket.getDiscountAmount().toString()); JLabel lblDeliveryCharge = new javax.swing.JLabel(); lblDeliveryCharge.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); lblDeliveryCharge.setText("Delivery Charge:" + " " + CurrencyUtil.getCurrencySymbol()); //$NON-NLS-1$ //$NON-NLS-2$ tfDeliveryCharge = new javax.swing.JTextField(10); tfDeliveryCharge.setHorizontalAlignment(SwingConstants.TRAILING); tfDeliveryCharge.setEditable(false); JLabel lblTax = new javax.swing.JLabel(); lblTax.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); lblTax.setText(com.floreantpos.POSConstants.TAX + ":" + " " + CurrencyUtil.getCurrencySymbol()); //$NON-NLS-1$ //$NON-NLS-2$ tfTax = new javax.swing.JTextField(10); // tfTax.setFont(tfTax.getFont().deriveFont(Font.PLAIN, 16)); tfTax.setEditable(false); tfTax.setHorizontalAlignment(SwingConstants.TRAILING); JLabel lblGratuity = new javax.swing.JLabel(); lblGratuity.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); lblGratuity .setText(Messages.getString("SettleTicketDialog.5") + ":" + " " + CurrencyUtil.getCurrencySymbol()); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ tfGratuity = new javax.swing.JTextField(10); tfGratuity.setEditable(false); tfGratuity.setHorizontalAlignment(SwingConstants.TRAILING); JLabel lblTotal = new javax.swing.JLabel(); lblTotal.setFont(lblTotal.getFont().deriveFont(Font.BOLD, PosUIManager.getFontSize(18))); lblTotal.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); lblTotal.setText(com.floreantpos.POSConstants.TOTAL + ":" + " " + CurrencyUtil.getCurrencySymbol()); //$NON-NLS-1$ //$NON-NLS-2$ tfTotal = new javax.swing.JTextField(10); tfTotal.setFont(tfTotal.getFont().deriveFont(Font.BOLD, PosUIManager.getFontSize(18))); tfTotal.setHorizontalAlignment(SwingConstants.TRAILING); tfTotal.setEditable(false); JPanel ticketAmountPanel = new com.floreantpos.swing.TransparentPanel( new MigLayout("hidemode 3,ins 2 2 3 2,alignx trailing,fill", "[grow]2[]", "")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ ticketAmountPanel.add(lblSubtotal, "growx,aligny center"); //$NON-NLS-1$ ticketAmountPanel.add(tfSubtotal, "growx,aligny center"); //$NON-NLS-1$ ticketAmountPanel.add(lblDiscount, "newline,growx,aligny center"); //$NON-NLS-1$ //$NON-NLS-2$ ticketAmountPanel.add(tfDiscount, "growx,aligny center"); //$NON-NLS-1$ ticketAmountPanel.add(lblTax, "newline,growx,aligny center"); //$NON-NLS-1$ ticketAmountPanel.add(tfTax, "growx,aligny center"); //$NON-NLS-1$ if (ticket.getOrderType().isDelivery() && !ticket.isCustomerWillPickup()) { ticketAmountPanel.add(lblDeliveryCharge, "newline,growx,aligny center"); //$NON-NLS-1$ ticketAmountPanel.add(tfDeliveryCharge, "growx,aligny center"); //$NON-NLS-1$ } ticketAmountPanel.add(lblGratuity, "newline,growx,aligny center"); //$NON-NLS-1$ ticketAmountPanel.add(tfGratuity, "growx,aligny center"); //$NON-NLS-1$ ticketAmountPanel.add(lblTotal, "newline,growx,aligny center"); //$NON-NLS-1$ ticketAmountPanel.add(tfTotal, "growx,aligny center"); //$NON-NLS-1$ return ticketAmountPanel; }
From source file:gov.nih.nci.nbia.StandaloneDMV3.java
private JPanel constructLoginPanel() { JPanel contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(36, 36, 36, 36)); contentPane.setLayout(null);/*from ww w . jav a 2 s.c o m*/ JPanel guestPanel = new JPanel(); guestPanel.setBounds(38, 40, 825, 140); guestPanel.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.RAISED, new Color(153, 180, 209), null), " For Guest ", TitledBorder.CENTER, TitledBorder.TOP, null, new Color(0, 120, 215))); contentPane.add(guestPanel); guestPanel.setLayout(null); JButton guestBtn = new JButton(GuestBtnLbl); guestBtn.setBounds(606, 50, 140, 36); guestBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { submitRequest(null, null); } }); guestPanel.add(guestBtn); JLabel guestLbl = new JLabel("Log in as a guest to download public data only"); guestLbl.setBounds(70, 50, 460, 42); guestPanel.add(guestLbl); JPanel loginUserPanel = new JPanel(); loginUserPanel.setBounds(40, 258, 825, 306); contentPane.add(loginUserPanel); loginUserPanel .setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.LOWERED, new Color(153, 180, 209), null), " Login to Download Authorized Data ", TitledBorder.CENTER, TitledBorder.TOP, null, new Color(0, 120, 215))); loginUserPanel.setLayout(null); JLabel lblNewLabel_1 = new JLabel("User Name"); lblNewLabel_1.setBounds(70, 80, 118, 36); loginUserPanel.add(lblNewLabel_1); JButton submitBtn = new JButton(SubmitBtnLbl); submitBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { userId = userNameFld.getText(); password = passwdFld.getText(); if ((userId.length() < 1) || (password.length() < 1)) { statusLbl.setText("Please enter a valid user name and password."); statusLbl.setForeground(Color.red); } else { submitRequest(userId, password); } } }); submitBtn.setBounds(606, 238, 140, 36); loginUserPanel.add(submitBtn); userNameFld = new JTextField(); userNameFld.setBounds(200, 80, 333, 36); loginUserPanel.add(userNameFld); userNameFld.setColumns(10); JLabel lblPassword = new JLabel("Password"); lblPassword.setBounds(70, 156, 118, 36); loginUserPanel.add(lblPassword); passwdFld = new JPasswordField(); passwdFld.setBounds(200, 156, 333, 36); loginUserPanel.add(passwdFld); statusLbl = new JLabel(""); statusLbl.setBounds(70, 226, 463, 36); loginUserPanel.add(statusLbl); JLabel lblOr = new JLabel("--- OR ---"); lblOr.setBounds(419, 212, 81, 26); contentPane.add(lblOr); JLabel versionLabel = new JLabel("Release " + DownloaderProperties.getAppVersion() + " Build \"" + DownloaderProperties.getBuildTime() + "\""); versionLabel.setHorizontalAlignment(SwingConstants.CENTER); versionLabel.setForeground(new Color(70, 130, 180)); versionLabel.setBounds(315, 584, 260, 20); contentPane.add(versionLabel); userNameFld.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { passwdFld.requestFocus(); } }); userNameFld.addFocusListener(new FocusListener() { @Override public void focusGained(FocusEvent e) { statusLbl.setText(""); } @Override public void focusLost(FocusEvent e) { } }); passwdFld.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { userId = userNameFld.getText(); password = passwdFld.getText(); if ((userId.length() < 1) || (password.length() < 1)) { statusLbl.setText("Please enter a valid user name and password."); statusLbl.setForeground(Color.red); } else submitRequest(userId, password); } }); passwdFld.addFocusListener(new FocusListener() { @Override public void focusGained(FocusEvent e) { statusLbl.setText(""); } @Override public void focusLost(FocusEvent e) { } }); return contentPane; }