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:com.hp.alm.ali.idea.content.settings.SettingsPanel.java
public SettingsPanel(final Project prj, Color bgColor) { this.prj = prj; this.projectConf = prj.getComponent(AliProjectConfiguration.class); previewAndConnection = new JPanel(new GridBagLayout()); previewAndConnection.setOpaque(false); GridBagConstraints c2 = new GridBagConstraints(); c2.gridx = 0;/*from www . ja v a2 s . c om*/ c2.gridy = 1; c2.gridwidth = 2; c2.weighty = 1; c2.fill = GridBagConstraints.VERTICAL; JPanel filler = new JPanel(); filler.setOpaque(false); previewAndConnection.add(filler, c2); passwordPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); passwordPanel.setBackground(bgColor); JLabel label = new JLabel("Password"); label.setFont(label.getFont().deriveFont(Font.BOLD)); passwordPanel.add(label); final JPasswordField password = new JPasswordField(24); passwordPanel.add(password); JButton connect = new JButton("Login"); passwordPanel.add(connect); final JLabel message = new JLabel(); passwordPanel.add(message); ActionListener connectionAction = new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { try { checkConnection(projectConf.getLocation(), projectConf.getDomain(), projectConf.getProject(), projectConf.getUsername(), password.getText()); } catch (AuthenticationFailed e) { message.setText(e.getMessage()); return; } projectConf.ALM_PASSWORD = password.getText(); projectConf.fireChanged(); } }; password.addActionListener(connectionAction); connect.addActionListener(connectionAction); restService = prj.getComponent(RestService.class); restService.addServerTypeListener(this); location = createTextPane(bgColor); domain = createTextPane(bgColor); project = createTextPane(bgColor); username = createTextPane(bgColor); final JPanel panel = new JPanel(new BorderLayout()); panel.setBackground(bgColor); panel.setBorder(new EmptyBorder(10, 10, 10, 10)); final JTextPane textPane = new JTextPane(); textPane.setEditorKit(new HTMLEditorKit()); textPane.setText( "<html><body>HP ALM integration can be configured on <a href=\"ide\">IDE</a> and overridden on <a href=\"project\">project</a> level.</body></html>"); textPane.setEditable(false); textPane.addHyperlinkListener(this); textPane.setBackground(bgColor); textPane.setCaret(new NonAdjustingCaret()); panel.add(textPane, BorderLayout.CENTER); JPanel content = new JPanel(new BorderLayout()); content.setBackground(bgColor); content.add(panel, BorderLayout.NORTH); content.add(previewAndConnection, BorderLayout.WEST); preview = new JPanel(new GridBagLayout()) { public Dimension getPreferredSize() { Dimension dim = super.getPreferredSize(); // make enough room for the connection status message dim.width = Math.max(dim.width, 300); return dim; } public Dimension getMinimumSize() { return getPreferredSize(); } }; connectedTo(restService.getServerTypeIfAvailable()); preview.setBackground(bgColor); final GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 1; c.gridx = 0; c.gridy = 0; c.gridwidth = 2; c.anchor = GridBagConstraints.WEST; preview.add(location, c); c.gridwidth = 1; c.gridy++; preview.add(domain, c); c.gridy++; preview.add(project, c); c.gridy++; preview.add(username, c); c.gridx++; c.gridy--; c.gridheight = 2; c.weightx = 0; c.anchor = GridBagConstraints.SOUTHEAST; final LinkLabel reload = new LinkLabel("Reload", IconLoader.getIcon("/actions/sync.png")); reload.setListener(new LinkListener() { public void linkSelected(LinkLabel linkLabel, Object o) { projectConf.fireChanged(); } }, null); preview.add(reload, c); JPanel previewNorth = new JPanel(new BorderLayout()); previewNorth.setBackground(bgColor); previewNorth.add(preview, BorderLayout.NORTH); addToGridBagPanel(0, 0, previewAndConnection, previewNorth); setBackground(bgColor); setLayout(new BorderLayout()); add(content, BorderLayout.CENTER); onChanged(); ApplicationManager.getApplication().getComponent(AliConfiguration.class).addListener(this); projectConf.addListener(this); }
From source file:projects.hip.exec.HrDiagram.java
/** * Main constructor./*from w ww .j av a2 s . c o m*/ */ public HrDiagram() { hipStars = HipUtils.loadHipCatalogue(); method = METHOD.NAIVE; fMax = 1.0; final JComboBox<METHOD> methodComboBox = new JComboBox<METHOD>(METHOD.values()); methodComboBox.setSelectedItem(method); methodComboBox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { method = (METHOD) methodComboBox.getSelectedItem(); updateChart(); } }); final JSlider fSlider = GuiUtil.buildSlider(0.0, 2.0, 5, "%3.3f"); fSlider.setValue((int) Math.rint(100.0 * fMax / 2.0)); final JLabel fLabel = new JLabel(getFLabel()); // Create a change listener fot these ChangeListener cl = new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { JSlider source = (JSlider) e.getSource(); if (source == fSlider) { // Compute fractional parallax error from slider position double newF = (2.0 * source.getValue() / 100.0); fMax = newF; fLabel.setText(getFLabel()); } updateChart(); } }; fSlider.addChangeListener(cl); // Add a bit of padding to space things out fSlider.setBorder(new EmptyBorder(5, 5, 5, 5)); // Present controls below the HR diagram JPanel controls = new JPanel(new GridLayout(2, 2)); controls.add(new JLabel("Distance estimation method:")); controls.add(methodComboBox); controls.add(fLabel); controls.add(fSlider); // Initialise the ChartPanel updateChart(); // Build the panel contents setLayout(new BorderLayout()); add(hrDiagPanel, BorderLayout.WEST); add(dDistPanel, BorderLayout.EAST); add(controls, BorderLayout.SOUTH); }
From source file:jku.ss09.mir.lastfmecho.bo.visualization.MirArtistNetworkGraphVisualizer.java
public boolean init() { if (artistList.size() > similarityMatrix.length) { System.out.println(//w ww . j a v a 2s . c om "Error in MirArtistNetworkGraphVisualizer - The similaritymatrix is smaller than number of artists "); return false; } graph = getGraph(SIMILARITY_DEFAULT / 100.0); setVisualizationRenderer(); // create a frome to hold the graph final JFrame frame = new JFrame(); Container content = frame.getContentPane(); final GraphZoomScrollPane panel = new GraphZoomScrollPane(vv); content.add(panel); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); final ModalGraphMouse gm = new DefaultModalGraphMouse<Integer, Number>(); vv.setGraphMouse(gm); final ScalingControl scaler = new CrossoverScalingControl(); JButton plus = new JButton("+"); plus.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { scaler.scale(vv, 1.1f, vv.getCenter()); } }); JButton minus = new JButton("-"); minus.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { scaler.scale(vv, 1 / 1.1f, vv.getCenter()); } }); JSlider slider = new JSlider(JSlider.HORIZONTAL, SIMILARITY_MIN, SIMILARITY_MAX, SIMILARITY_DEFAULT); slider.setMajorTickSpacing(10); slider.setPaintTicks(true); final JLabel sliderLabel = new JLabel("0.87"); final MirArtistNetworkGraphVisualizer thisPointer = this; slider.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent arg0) { JSlider source = (JSlider) arg0.getSource(); if (!source.getValueIsAdjusting()) { System.out.println(source.getValue() / 100.0); Graph testG = getGraph(source.getValue() / 100.0); sliderLabel.setText(Double.toString(source.getValue() / 100.0)); thisPointer.vv.setGraphLayout(new FRLayout<Integer, Number>(testG)); //thisPointer.setVisualizationRenderer(); thisPointer.vv.validate(); thisPointer.vv.repaint(); } } }); JPanel controls = new JPanel(); controls.add(plus); controls.add(minus); controls.add(((DefaultModalGraphMouse<Integer, Number>) gm).getModeComboBox()); controls.add(new JLabel("Similarity Limit: ")); controls.add(sliderLabel); controls.add(slider); content.add(controls, BorderLayout.SOUTH); frame.pack(); frame.setVisible(true); return true; }
From source file:com.haulmont.cuba.desktop.App.java
protected JComponent createBottomPane() { JPanel panel = new JPanel(new BorderLayout()); panel.setBorder(BorderFactory.createLineBorder(Color.gray)); panel.setPreferredSize(new Dimension(0, 20)); ServerSelector serverSelector = AppBeans.get(ServerSelector.NAME); String url = serverSelector.getUrl(serverSelector.initContext()); if (url == null) url = "?"; final JLabel connectionStateLab = new JLabel( messages.formatMainMessage("statusBar.connected", getUserFriendlyConnectionUrl(url))); panel.add(connectionStateLab, BorderLayout.WEST); JPanel rightPanel = new JPanel(); BoxLayout rightLayout = new BoxLayout(rightPanel, BoxLayout.LINE_AXIS); rightPanel.setLayout(rightLayout);/* w w w.j a v a 2 s .c o m*/ UserSession session = connection.getSession(); JLabel userInfoLabel = new JLabel(); String userInfo = messages.formatMainMessage("statusBar.user", session.getUser().getName(), session.getUser().getLogin()); userInfoLabel.setText(userInfo); rightPanel.add(userInfoLabel); JLabel timeZoneLabel = null; if (session.getTimeZone() != null) { timeZoneLabel = new JLabel(); String timeZone = messages.formatMainMessage("statusBar.timeZone", AppBeans.get(TimeZones.class).getDisplayNameShort(session.getTimeZone())); timeZoneLabel.setText(timeZone); rightPanel.add(Box.createRigidArea(new Dimension(5, 0))); rightPanel.add(timeZoneLabel); } panel.add(rightPanel, BorderLayout.EAST); if (isTestMode()) { panel.setName("bottomPane"); userInfoLabel.setName("userInfoLabel"); if (timeZoneLabel != null) timeZoneLabel.setName("timeZoneLabel"); connectionStateLab.setName("connectionStateLab"); } return panel; }
From source file:com.smanempat.controller.ControllerClassification.java
public void validasiNumberofNearest(java.awt.event.KeyEvent evt, JTextField textNumberOfK, JLabel labelPesanError) { ModelClassification modelClassification = new ModelClassification(); String numberValidate = textNumberOfK.getText(); int modelRow = modelClassification.getRowCount(); if (Pattern.matches("[0-9]+", numberValidate) == false && numberValidate.length() > 0) { evt.consume();/*from w w w. j ava 2 s.c o m*/ labelPesanError.setText("Number of Nearest Neighbor tidak valid"); } else if (numberValidate.length() == 9) { evt.consume(); labelPesanError.setText("Number of Nearest Neighbor terlalu panjang"); } else { labelPesanError.setText(""); } }
From source file:projects.upc.exec.HrDiagram.java
/** * Main constructor.// w w w. j a v a 2 s .com */ public HrDiagram() { List<UpcStar> upcStars = UpcUtils.loadUpcCatalogue(); List<UpcStar> hipStars = UpcUtils.getHipparcosSubset(upcStars); List<UpcStar> unmatchedStars = UpcUtils.getUnmatchedSubset(upcStars); upcStarCrossMatches = XmUtil.getUpcStarCrossMatchMap(upcStars); hipStarCrossMatches = XmUtil.getUpcStarCrossMatchMap(hipStars); unmatchedStarCrossMatches = XmUtil.getUpcStarCrossMatchMap(unmatchedStars); logger.info("Loaded " + upcStarCrossMatches.size() + " UpcStars with SSA cross matches"); logger.info("Loaded " + hipStarCrossMatches.size() + " UpcStars with Hipparcos and SSA cross matches"); logger.info("Loaded " + unmatchedStarCrossMatches.size() + " UpcStars with no parallax cross-match, and with SSA cross matches"); starsToPlot = upcStarCrossMatches; useHip = false; method = METHOD.NAIVE; fMax = 1.0; final JCheckBox plotAllCheckBox = new JCheckBox("Plot all UPC stars: ", true); plotAllCheckBox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (plotAllCheckBox.isSelected()) { starsToPlot = upcStarCrossMatches; updateChart(); } } }); final JCheckBox plotHipCheckBox = new JCheckBox("Plot Hipparcos stars only: ", false); plotHipCheckBox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (plotHipCheckBox.isSelected()) { starsToPlot = hipStarCrossMatches; updateChart(); } } }); final JCheckBox plotUnmatchedCheckBox = new JCheckBox("Plot all stars with no external match: ", false); plotUnmatchedCheckBox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (plotUnmatchedCheckBox.isSelected()) { starsToPlot = unmatchedStarCrossMatches; updateChart(); } } }); final ButtonGroup bg = new ButtonGroup(); bg.add(plotHipCheckBox); bg.add(plotAllCheckBox); bg.add(plotUnmatchedCheckBox); JCheckBox useHipCheckBox = new JCheckBox("Use Hipparcos parallaxes when available", useHip); useHipCheckBox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { useHip = !useHip; updateChart(); } }); final JComboBox<METHOD> methodComboBox = new JComboBox<METHOD>(METHOD.values()); methodComboBox.setSelectedItem(method); methodComboBox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { method = (METHOD) methodComboBox.getSelectedItem(); updateChart(); } }); final JSlider fSlider = GuiUtil.buildSlider(0.0, 2.0, 5, "%3.3f"); fSlider.setValue((int) Math.rint(100.0 * fMax)); final JLabel fLabel = new JLabel(getFLabel()); // Create a change listener fot these ChangeListener cl = new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { JSlider source = (JSlider) e.getSource(); if (source == fSlider) { // Compute fractional parallax error from slider position double newF = (2.0 * source.getValue() / 100.0); fMax = newF; fLabel.setText(getFLabel()); } updateChart(); } }; fSlider.addChangeListener(cl); // Add a bit of padding to space things out fSlider.setBorder(new EmptyBorder(5, 5, 5, 5)); // Present controls below the HR diagram JPanel controls = new JPanel(new GridLayout(3, 3)); controls.add(plotAllCheckBox); controls.add(plotHipCheckBox); controls.add(plotUnmatchedCheckBox); controls.add(new JLabel("Distance estimation method:")); controls.add(methodComboBox); controls.add(useHipCheckBox); controls.add(fLabel); controls.add(fSlider); // Initialise the ChartPanel updateChart(); // Build the panel contents setLayout(new BorderLayout()); add(chartPanel, BorderLayout.CENTER); add(controls, BorderLayout.SOUTH); }
From source file:com.floreantpos.ui.views.payment.SettleTicketDialog.java
private JPanel createTicketInfoPanel() { JLabel lblTicket = new javax.swing.JLabel(); lblTicket.setText(Messages.getString("SettleTicketDialog.0")); //$NON-NLS-1$ JLabel labelTicketNumber = new JLabel(); labelTicketNumber.setText("[" + String.valueOf(ticket.getId()) + "]"); //$NON-NLS-1$ //$NON-NLS-2$ JLabel lblTable = new javax.swing.JLabel(); lblTable.setText(", " + Messages.getString("SettleTicketDialog.3")); //$NON-NLS-1$ //$NON-NLS-2$ JLabel labelTableNumber = new JLabel(); labelTableNumber.setText("[" + getTableNumbers(ticket.getTableNumbers()) + "]"); //$NON-NLS-1$ //$NON-NLS-2$ if (ticket.getTableNumbers().isEmpty()) { labelTableNumber.setVisible(false); lblTable.setVisible(false);/*from www .j a va 2s.co m*/ } JLabel lblCustomer = new javax.swing.JLabel(); lblCustomer.setText(", " + Messages.getString("SettleTicketDialog.10") + ": "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ JLabel labelCustomer = new JLabel(); labelCustomer.setText(ticket.getProperty(Ticket.CUSTOMER_NAME)); if (ticket.getProperty(Ticket.CUSTOMER_NAME) == null) { labelCustomer.setVisible(false); lblCustomer.setVisible(false); } JPanel ticketInfoPanel = new com.floreantpos.swing.TransparentPanel( new MigLayout("hidemode 3,insets 0", "[]0[]0[]0[]0[]0[]", "[]")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ ticketInfoPanel.add(lblTicket); ticketInfoPanel.add(labelTicketNumber); ticketInfoPanel.add(lblTable); ticketInfoPanel.add(labelTableNumber); ticketInfoPanel.add(lblCustomer); ticketInfoPanel.add(labelCustomer); return ticketInfoPanel; }
From source file:com.willwinder.ugs.nbp.setupwizard.panels.WizardPanelStepCalibration.java
private void updateEstimationFromMesurement(JTextField textFieldMesurement, Axis axis, JLabel label) { if (getBackend().getWorkPosition() != null) { try {//from ww w .j av a2 s .com double measured = decimalFormat.parse(textFieldMesurement.getText()).doubleValue(); double real = getBackend().getWorkPosition().get(axis); int stepsPerMM = getBackend().getController().getFirmwareSettings().getStepsPerMillimeter(axis); double computed = (real / measured) * ((double) stepsPerMM); if (measured == 0 || real == 0) { computed = 0; } label.setText(Math.abs(Math.round(computed)) + " steps/mm est."); } catch (FirmwareSettingsException | ParseException ignored) { // Never mind } } }
From source file:com.sec.ose.osi.ui.frm.login.JPanLogin.java
/** * This method initializes jPanelUserInfo * // ww w .j av a 2 s . c om * @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:org.micromanager.CRISP.CRISPFrame.java
private void CalibrateButton_ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CalibrateButton_ActionPerformed try {// w ww . j ava 2 s. c o m core_.setProperty(CRISP_, "CRISP State", "loG_cal"); String state = ""; int counter = 0; while (!state.equals("loG_cal") && counter < 50) { state = core_.getProperty(CRISP_, "CRISP State"); Thread.sleep(100); } Double snr = new Double(core_.getProperty(CRISP_, "Signal Noise Ratio")); if (snr < 2.0) ReportingUtils.showMessage("Signal Noise Ratio is smaller than 2.0. " + "Focus on your sample, increase LED intensity and try again."); core_.setProperty(CRISP_, "CRISP State", "Dither"); String value = core_.getProperty(CRISP_, "Dither Error"); final JLabel jl = new JLabel(); final JLabel jlA = new JLabel(); final JLabel jlB = new JLabel(); final String msg1 = "Value: "; final String msg2 = "Adjust the detector lateral adjustment screw until the value is > 100 or" + "< -100 and stable."; jlA.setText(msg1); jl.setText(value); jl.setAlignmentX(JLabel.CENTER); Object[] msg = { msg1, jl, msg2 }; ActionListener al = new ActionListener() { public void actionPerformed(ActionEvent evt) { try { jl.setText(core_.getProperty(CRISP_, "Dither Error")); } catch (Exception ex) { ReportingUtils.logError("Error while getting CRISP dither Error"); } } }; Timer timer = new Timer(100, al); timer.setInitialDelay(500); timer.start(); /*JOptionPane optionPane = new JOptionPane(new JLabel("Hello World",JLabel.CENTER)); JDialog dialog = optionPane.createDialog(""); dialog.setModal(true); dialog.setVisible(true); */ JOptionPane.showMessageDialog(null, msg, "CRISP Calibration", JOptionPane.OK_OPTION); timer.stop(); core_.setProperty(CRISP_, "CRISP State", "gain_Cal"); counter = 0; while (!state.equals("Ready") && counter < 50) { state = core_.getProperty(CRISP_, "CRISP State"); Thread.sleep(100); } // ReportingUtils.showMessage("Calibration failed. Focus, make sure that the NA variable is set correctly and try again."); } catch (Exception ex) { ReportingUtils.showMessage( "Calibration failed. Focus, make sure that the NA variable is set correctly and try again."); } }