Java Code Examples for javax.swing.JTextArea#setToolTipText()

The following examples show how to use javax.swing.JTextArea#setToolTipText() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MyTableCellRenderer.java    From mts with GNU General Public License v3.0 5 votes vote down vote up
public JTextArea getJTextArea(boolean selected)
{
    JTextArea jTextArea = new JTextArea();
    jTextArea.setMargin(new Insets(0,0,0,0));
    jTextArea.setLineWrap(true);
    jTextArea.setWrapStyleWord(false);
    jTextArea.setFont(Font.decode("Monospaced"));
    jTextArea.setToolTipText("Click to expand");
    return jTextArea;
}
 
Example 2
Source File: ReportDefect.java    From Cognizant-Intelligent-Test-Scripter with Apache License 2.0 5 votes vote down vote up
/**
 * set up the listener for the text area editor open the full size editor on
 * right click
 *
 * @param jTextArea - target text area control
 */
private void setListener(final JTextArea jTextArea) {
    jTextArea.addMouseListener(new java.awt.event.MouseAdapter() {
        @Override
        public void mousePressed(MouseEvent e) {
            if (SwingUtilities.isRightMouseButton(e)) {
                panelTextArea.setText(jTextArea.getText());
                temp = jTextArea;
                showNext();
                panelTextArea.requestFocus();
            }
        }
    });
    jTextArea.setToolTipText("Press Right click to edit in Full Mode");
}
 
Example 3
Source File: SettingsEditor.java    From gcs with Mozilla Public License 2.0 5 votes vote down vote up
private JPanel createTopPanel() {
    JPanel panel = new JPanel(new PrecisionLayout().setColumns(2).setMargins(10));
    mShowCollegeInSpells = createCheckBox(panel, I18n.Text("Show the College column in the spells list"), null, mSettings.showCollegeInSpells());
    mBaseWillAndPerOn10 = createCheckBox(panel, I18n.Text("Base Will and Perception on 10 and not IQ"), null, mSettings.baseWillAndPerOn10());
    mUseMultiplicativeModifiers = createCheckBox(panel, I18n.Text("Use Multiplicative Modifiers from PW102 (note: changes point value)"), null, mSettings.useMultiplicativeModifiers());
    mUseModifyingDicePlusAdds = createCheckBox(panel, I18n.Text("Use Modifying Dice + Adds from B269"), null, mSettings.useModifyingDicePlusAdds());
    mUseKnowYourOwnStrength = createCheckBox(panel, I18n.Text("Use strength rules from Knowing Your Own Strength (PY83)"), null, mSettings.useKnowYourOwnStrength());
    mUseReducedSwing = createCheckBox(panel, I18n.Text("Use the reduced swing rules from Adjusting Swing Damage in Dungeon Fantasy"), "From noschoolgrognard.blogspot.com", mSettings.useReducedSwing());
    mUseThrustEqualsSwingMinus2 = createCheckBox(panel, I18n.Text("Use Thrust = Swing - 2"), null, mSettings.useThrustEqualsSwingMinus2());
    mUseSimpleMetricConversions = createCheckBox(panel, I18n.Text("Use the simple metric conversion rules from B9"), null, mSettings.useSimpleMetricConversions());
    JPanel wrapper = new JPanel();
    wrapper.add(createLabel(I18n.Text("Use"), null, SwingConstants.LEFT));
    mLengthUnitsCombo = createCombo(wrapper, LengthUnits.values(), mSettings.defaultLengthUnits(), I18n.Text("The units to use for display of generated lengths"));
    wrapper.add(createLabel(I18n.Text("and"), null, SwingConstants.LEFT));
    mWeightUnitsCombo = createCombo(wrapper, WeightUnits.values(), mSettings.defaultWeightUnits(), I18n.Text("The units to use for display of generated weights"));
    wrapper.add(createLabel(I18n.Text("for display of generated units"), null, SwingConstants.LEFT));
    panel.add(wrapper, new PrecisionLayoutData().setHorizontalSpan(2));
    panel.add(createLabel(I18n.Text("Show User Description"), null, SwingConstants.RIGHT), new PrecisionLayoutData().setHorizontalAlignment(PrecisionLayoutAlignment.END).setLeftMargin(5).setRightMargin(5));
    mUserDescriptionDisplayCombo = createCombo(panel, DisplayOption.values(), mSettings.userDescriptionDisplay(), I18n.Text("Where to display this information"));
    panel.add(createLabel(I18n.Text("Show Modifiers"), null, SwingConstants.RIGHT), new PrecisionLayoutData().setHorizontalAlignment(PrecisionLayoutAlignment.END).setLeftMargin(5).setRightMargin(5));
    mModifiersDisplayCombo = createCombo(panel, DisplayOption.values(), mSettings.modifiersDisplay(), I18n.Text("Where to display this information"));
    panel.add(createLabel(I18n.Text("Show Notes"), null, SwingConstants.RIGHT), new PrecisionLayoutData().setHorizontalAlignment(PrecisionLayoutAlignment.END).setLeftMargin(5).setRightMargin(5));
    mNotesDisplayCombo = createCombo(panel, DisplayOption.values(), mSettings.notesDisplay(), I18n.Text("Where to display this information"));
    String blockLayoutTooltip = Text.wrapPlainTextForToolTip(I18n.Text("Specifies the layout of the various blocks of data on the character sheet"));
    panel.add(createLabel(I18n.Text("Block Layout"), blockLayoutTooltip, SwingConstants.LEFT), new PrecisionLayoutData().setHorizontalSpan(2).setLeftMargin(5).setRightMargin(5));
    mBlockLayoutField = new JTextArea(Preferences.linesToString(mSettings.blockLayout()));
    mBlockLayoutField.setToolTipText(blockLayoutTooltip);
    mBlockLayoutField.getDocument().addDocumentListener(this);
    mBlockLayoutField.setBorder(new CompoundBorder(new LineBorder(), new EmptyBorder(0, 4, 0, 4)));
    panel.add(mBlockLayoutField, new PrecisionLayoutData().setHorizontalSpan(2).setFillAlignment().setGrabSpace(true).setLeftMargin(5).setRightMargin(5));
    return panel;
}
 
Example 4
Source File: DisplayPreferences.java    From gcs with Mozilla Public License 2.0 5 votes vote down vote up
private JTextArea createTextArea(String tooltip, String value) {
    JTextArea field = new JTextArea(value);
    field.setToolTipText(Text.wrapPlainTextForToolTip(tooltip));
    field.getDocument().addDocumentListener(this);
    field.setBorder(new CompoundBorder(new LineBorder(), new EmptyBorder(0, 4, 0, 4)));
    add(field);
    return field;
}
 
Example 5
Source File: SharedFunctions.java    From zap-extensions with Apache License 2.0 5 votes vote down vote up
public static JTextArea createTextArea(int rows, int cols, String tip, int limit) {
    JTextArea txt = new JTextArea(rows, cols);
    if (limit > -1) {
        txt.setDocument(new JTextFieldLimit(limit));
    }
    txt.setToolTipText(tip);
    txt.setLineWrap(true);
    txt.setWrapStyleWord(true);
    return txt;
}
 
Example 6
Source File: WhiteRabbitMain.java    From WhiteRabbit with Apache License 2.0 5 votes vote down vote up
private JComponent createConsolePanel() {
	JTextArea consoleArea = new JTextArea();
	consoleArea.setToolTipText("General progress information");
	consoleArea.setEditable(false);
	Console console = new Console();
	console.setTextArea(consoleArea);
	System.setOut(new PrintStream(console));
	System.setErr(new PrintStream(console));
	JScrollPane consoleScrollPane = new JScrollPane(consoleArea);
	consoleScrollPane.setBorder(BorderFactory.createTitledBorder("Console"));
	consoleScrollPane.setPreferredSize(new Dimension(800, 200));
	consoleScrollPane.setAutoscrolls(true);
	ObjectExchange.console = console;
	return consoleScrollPane;
}
 
Example 7
Source File: TesteComponentes.java    From dctb-utfpr-2018-1 with Apache License 2.0 4 votes vote down vote up
public void TesteComponente(){
    janela.setVisible(true);
    janela.setSize(DIMENSOES);
    janela.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    
    JScrollPane teste1 = new JScrollPane(painel);
    teste1.setBounds(1, 2, 150, 200);
    
    JButton teste2 = new JButton("Aperte");
    teste2.setBounds(210, 2, 100, 100);
    
    JToggleButton teste3 = new JToggleButton("Toggle");
    teste3.setBounds(320, 2, 100, 100);
    
    JCheckBox teste4 = new JCheckBox("Teste");
    teste4.setBounds(430, 2, 100, 100);
    
    JRadioButton teste5 = new JRadioButton("Teste2");
    teste5.setBounds(540, 2, 100, 100);
    
    JTextField teste6 = new JTextField();
    teste6.setToolTipText("Seu Nome");
    teste6.setBounds(1, 205, 200, 50);
    
    String[] numeros = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10"};
    JList teste7 = new JList(numeros);
    JScrollPane teste7_2 = new JScrollPane(teste7);
    teste7_2.setBounds(210, 205, 100, 100);
    
    String[] numeros2 = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10"};
    JComboBox teste8 = new JComboBox(numeros2);
    teste8.setBounds(320, 205, 50, 50);
    
    JLabel teste9 = new JLabel();
    teste9.setText("Biografia: ");
    teste9.setBounds(1, 290, 200, 100);
    
    JTextArea teste10 = new JTextArea();
    teste10.setToolTipText("Biografia");
    teste10.setBounds(1, 350, 100, 100);
    
    teste2.addActionListener(this);
    teste3.addActionListener(this);
    teste4.addActionListener(this);
    teste5.addActionListener(this);
    
    janela.add(teste1);
    janela.add(teste2);
    janela.add(teste3);
    janela.add(teste4);
    janela.add(teste5);
    janela.add(teste6);
    janela.add(teste7);
    janela.add(teste8);
    janela.add(teste9);
    janela.add(teste10);
}
 
Example 8
Source File: JTableLogs.java    From mts with GNU General Public License v3.0 4 votes vote down vote up
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
    JTextArea jTextArea = super.getJTextArea(isSelected);
    TextEvent textEvent = (TextEvent) table.getModel().getValueAt(row, column);

    if (null == value) {
        jTextArea.setText("");
        jTextArea.setBackground(Color.WHITE);
        jTextArea.setForeground(Color.BLACK);
    }
    else {
        String text = textEvent.getText();
        jTextArea.setText(text);

        jTextArea.setBackground(GuiHelper.getColorForTopic(textEvent.getTopic()));
        jTextArea.setForeground(GuiHelper.getColorForLevel(textEvent.getLevel()));

        jTextArea.setMinimumSize(new Dimension(table.getRowHeight(), table.getRowHeight()));

        // to get the prefered height
        jTextArea.setSize(table.getColumnModel().getColumn(column).getWidth(), -1);
        jTextArea.setSize(table.getColumnModel().getColumn(column).getWidth(), (int) jTextArea.getPreferredSize().getHeight());
        int preferedHeight = (int) Math.round(jTextArea.getPreferredSize().getHeight());

        // set the prefered height if is different
        if (table.getRowHeight(row) != preferedHeight && table.getRowHeight(row) != table.getRowHeight()) {
            table.setRowHeight(row, preferedHeight);
        }
        if (search != null) {
            if (text.toLowerCase().contains(search)) {
                jTextArea.setBackground(Color.ORANGE);
                jTextArea.setForeground(Color.BLACK);
            }
        }
        if ((row == index) && (index > -1)) {
            jTextArea.setBackground(Color.YELLOW);
            jTextArea.setForeground(Color.BLACK);

          //  table.setRowHeight(row, (int) jTextArea.getPreferredSize().getHeight());
        }

    }

    if (table.getRowHeight(row) != table.getRowHeight()) {
        jTextArea.setToolTipText("Click to collapse");
    }

    return jTextArea;
}
 
Example 9
Source File: ParametersPanel.java    From hortonmachine with GNU General Public License v3.0 4 votes vote down vote up
private void addInputs( final List<FieldData> inputsList ) {
    rasterComboList = new ArrayList<>();
    vectorComboList = new ArrayList<>();
    CellConstraints cc = new CellConstraints();
    int row = 1;
    for( FieldData inputField : inputsList ) {
        if (inputField.fieldName.equals(PM_VAR_NAME)) {
            continue;
        }
        String fieldDescription = inputField.fieldDescription;
        String fieldLabel = fieldDescription;
        String fieldTooltip = fieldDescription;

        JTextArea nameLabel = new JTextArea();
        nameLabel.setOpaque(false);
        nameLabel.setLineWrap(true);
        nameLabel.setWrapStyleWord(true);
        nameLabel.setText(fieldLabel);
        nameLabel.setToolTipText(fieldTooltip);
        nameLabel.setEditable(false);

        TypeCheck fileCheck = getFileCheck(inputField);
        if (fileCheck.isOutput) {
            Font font = nameLabel.getFont();
            Font boldFont = new Font(font.getFontName(), Font.BOLD, font.getSize());
            nameLabel.setFont(boldFont);
        }
        this.add(nameLabel, cc.xy(1, row));

        // the rest of it
        int col = 3;

        if (isAtLeastOneAssignable(inputField.fieldType, String.class)) {
            if (inputField.guiHints != null && inputField.guiHints.startsWith(HMConstants.MULTILINE_UI_HINT)) {
                handleTextArea(inputField, row, col, cc);
            } else if (inputField.guiHints != null && inputField.guiHints.startsWith(HMConstants.COMBO_UI_HINT)) {
                handleComboField(inputField, row, col, cc);
            } else {
                handleTextField(inputField, row, col, cc, false, fileCheck);
            }
        } else if (isAtLeastOneAssignable(inputField.fieldType, Double.class, double.class)) {
            handleTextField(inputField, row, col, cc, true, fileCheck);
        } else if (isAtLeastOneAssignable(inputField.fieldType, Float.class, float.class)) {
            handleTextField(inputField, row, col, cc, true, fileCheck);
        } else if (isAtLeastOneAssignable(inputField.fieldType, Integer.class, int.class)) {
            handleTextField(inputField, row, col, cc, true, fileCheck);
        } else if (isAtLeastOneAssignable(inputField.fieldType, Short.class, short.class)) {
            handleTextField(inputField, row, col, cc, true, fileCheck);
        } else if (isAtLeastOneAssignable(inputField.fieldType, Boolean.class, boolean.class)) {
            handleBooleanField(inputField, row, col, cc);
            // } else if (isAtLeastOneAssignable(inputField.fieldType, GridCoverage2D.class)) {
            // handleGridcoverageInputField(inputField, row, col, cc);
            // } else if (isAtLeastOneAssignable(inputField.fieldType, GridGeometry2D.class)) {
            // handleGridgeometryInputField(inputField, row, col, cc);
            // } else if (isAtLeastOneAssignable(inputField.fieldType,
            // SimpleFeatureCollection.class)) {
            // handleFeatureInputField(inputField, row, col, cc);
            // } else if (isAtLeastOneAssignable(inputField.fieldType, HashMap.class)) {
            // handleHashMapInputField(inputField, row, col, cc);
            // } else if (isAtLeastOneAssignable(inputField.fieldType, List.class)) {
            // if (inputField.guiHints != null &&
            // inputField.guiHints.equals(OmsBoxConstants.FILESPATHLIST_UI_HINT)) {
            // handleFilesPathListInputField(inputField, row, col, cc);
            // } else {
            // handleListInputField(inputField, row, col, cc);
        }

        row++;
        this.add(new JSeparator(JSeparator.HORIZONTAL), cc.xy(1, row));
        this.add(new JSeparator(JSeparator.HORIZONTAL), cc.xy(2, row));
        this.add(new JSeparator(JSeparator.HORIZONTAL), cc.xy(3, row));
        row++;

        // row = row + 3;
    }
}
 
Example 10
Source File: TablePagePanel.java    From snap-desktop with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void customise(JTable table, JTextArea component, String value, int rowIndex, int colIndex) {
    component.setToolTipText(value);
}