List of usage examples for javax.swing JTextField setToolTipText
@BeanProperty(bound = false, preferred = true, description = "The text to display in a tool tip.") public void setToolTipText(String text)
From source file:op.controlling.PnlControlling.java
private JPanel createContentPanel4Nutrition() { JPanel pnlContent = new JPanel(new VerticalLayout()); /***//from w w w . j a v a 2 s .co m * _ _ _ _ _ _ * | (_) __ _ _ _(_) __| | | |__ __ _| | __ _ _ __ ___ ___ * | | |/ _` | | | | |/ _` | | '_ \ / _` | |/ _` | '_ \ / __/ _ \ * | | | (_| | |_| | | (_| | | |_) | (_| | | (_| | | | | (_| __/ * |_|_|\__, |\__,_|_|\__,_| |_.__/ \__,_|_|\__,_|_| |_|\___\___| * |_| */ JPanel pnlLiquidBalance = new JPanel(new BorderLayout()); final JButton btnLiquidBalance = GUITools.createHyperlinkButton("opde.controlling.nutrition.liquidbalance", null, null); final JComboBox cmbLiquidBalanceMonth = new JComboBox( SYSCalendar.createMonthList(new LocalDate().minusYears(1), new LocalDate())); btnLiquidBalance.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { OPDE.getMainframe().setBlocked(true); SwingWorker worker = new SwingWorker() { @Override protected Object doInBackground() throws Exception { LocalDate month = (LocalDate) cmbLiquidBalanceMonth.getSelectedItem(); SYSFilesTools.print(ResValueTools.getLiquidBalance(month, progressClosure), false); return null; } @Override protected void done() { OPDE.getDisplayManager().setProgressBarMessage(null); OPDE.getMainframe().setBlocked(false); } }; worker.execute(); } }); cmbLiquidBalanceMonth.setRenderer(new ListCellRenderer() { @Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { return new DefaultListCellRenderer().getListCellRendererComponent(list, monthFormatter.format(((LocalDate) value).toDate()), index, isSelected, cellHasFocus); } }); cmbLiquidBalanceMonth.setSelectedIndex(cmbLiquidBalanceMonth.getItemCount() - 2); pnlLiquidBalance.add(btnLiquidBalance, BorderLayout.WEST); pnlLiquidBalance.add(cmbLiquidBalanceMonth, BorderLayout.EAST); pnlContent.add(pnlLiquidBalance); /*** * _ _ _ _ _ _ _ _ * __ _____(_) __ _| |__ | |_ ___| |_ __ _| |_(_)___| |_(_) ___ ___ * \ \ /\ / / _ \ |/ _` | '_ \| __| / __| __/ _` | __| / __| __| |/ __/ __| * \ V V / __/ | (_| | | | | |_ \__ \ || (_| | |_| \__ \ |_| | (__\__ \ * \_/\_/ \___|_|\__, |_| |_|\__| |___/\__\__,_|\__|_|___/\__|_|\___|___/ * |___/ */ JPanel pnlWeight = new JPanel(new BorderLayout()); final JButton btnWeightStats = GUITools.createHyperlinkButton("opde.controlling.nutrition.weightstats", null, null); int wsMonthsBack; try { wsMonthsBack = Integer.parseInt(OPDE.getProps().getProperty("opde.controlling::wsMonthsBack")); } catch (NumberFormatException nfe) { wsMonthsBack = 7; } final JTextField txtWSMonthsBack = GUITools.createIntegerTextField(1, 24, wsMonthsBack); txtWSMonthsBack.setToolTipText(SYSTools.xx("misc.msg.monthsback")); btnWeightStats.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { OPDE.getMainframe().setBlocked(true); SwingWorker worker = new SwingWorker() { @Override protected Object doInBackground() throws Exception { SYSPropsTools.storeProp("opde.controlling::wsMonthsBack", txtWSMonthsBack.getText(), OPDE.getLogin().getUser()); SYSFilesTools.print(ResValueTools.getWeightStats( Integer.parseInt(txtWSMonthsBack.getText()), progressClosure), false); return null; } @Override protected void done() { OPDE.getDisplayManager().setProgressBarMessage(null); OPDE.getMainframe().setBlocked(false); } }; worker.execute(); } }); pnlWeight.add(btnWeightStats, BorderLayout.WEST); pnlWeight.add(txtWSMonthsBack, BorderLayout.EAST); pnlContent.add(pnlWeight); return pnlContent; }
From source file:openlr.mapviewer.coding.ui.AbstractCodingOptionsDialog.java
/** * Sets up an input field of the form/* w w w . j av a2 s . c om*/ * * @param propKey * The full configuration property key this field relates to * @param value * The initial value to set * @return The set-up input field */ private JTextField createInputField(final String propKey, final String value) { final JTextField valueField = new JTextField(); valueField.setText(value); valueField.setHorizontalAlignment(JTextField.RIGHT); valueField.setPreferredSize(new Dimension(WIDT_INPUT_FIELD, valueField.getHeight())); optionsTextFields.put(propKey, valueField); final String defaultValue = defaultConfig.getString(propKey); valueField.getDocument().addDocumentListener(new VisualPropertyChangeListener(valueField, defaultValue)); if (!defaultValue.equals(value)) { valueField.setBackground(VisualPropertyChangeListener.COLOR_FIELD_VALUE_DIFF_DEFAULT); } StringBuilder toolTip = new StringBuilder(); toolTip.append(propKey).append(", default: ").append(defaultValue); valueField.setToolTipText(toolTip.toString()); afterInputFieldCreation(propKey, valueField); return valueField; }
From source file:org.executequery.gui.drivers.AbstractDriverPanel.java
private JTextField textFieldWithKey(String key) { JTextField field = WidgetFactory.createTextField(); field.setToolTipText(getString(key)); return field; }