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

The following examples show how to use javax.swing.JCheckBox#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: SaveField.java    From Hollow-Knight-SaveManager with GNU General Public License v3.0 6 votes vote down vote up
private void initDreamField(){
	JCheckBox rankOne = new JCheckBox("",json.get(jpath[0]).getAsBoolean());
	JCheckBox rankTwo = new JCheckBox("",json.get(jpath[1]).getAsBoolean());
	JCheckBox rankThr = new JCheckBox("",json.get(jpath[2]).getAsBoolean());
	
	rankOne.setToolTipText("Dreamnail");
	rankTwo.setToolTipText("Dreamgate");
	rankThr.setToolTipText("Awakened Dreamnail");
	
	BoolCheckboxListener bcl1 = new BoolCheckboxListener(rankOne, json, jpath[0]); 
	BoolCheckboxListener bcl2 = new BoolCheckboxListener(rankTwo, json, jpath[1]); 
	BoolCheckboxListener bcl3 = new BoolCheckboxListener(rankThr, json, jpath[2]); 
	
	rankOne.addActionListener(bcl1);
	rankTwo.addActionListener(bcl2);
	rankThr.addActionListener(bcl3);
	
	JPanel container = new JPanel();
	container.add(rankOne);
	container.add(rankTwo);
	container.add(rankThr);
	this.add(container, BorderLayout.LINE_START);
}
 
Example 2
Source File: TechniqueEditor.java    From gcs with Mozilla Public License 2.0 6 votes vote down vote up
private void createLimits(Container parent) {
    JPanel wrapper = new JPanel(new ColumnLayout(3));

    mLimitCheckbox = new JCheckBox(I18n.Text("Cannot exceed default skill level by more than"), mRow.isLimited());
    mLimitCheckbox.setToolTipText(Text.wrapPlainTextForToolTip(I18n.Text("Whether to limit the maximum level that can be achieved or not")));
    mLimitCheckbox.addActionListener(this);
    mLimitCheckbox.setEnabled(mIsEditable);

    mLimitField = createNumberField(null, wrapper, null, I18n.Text("The maximum amount above the default skill level that this technique can be raised"), mRow.getLimitModifier(), 2);
    mLimitField.setEnabled(mIsEditable && mLimitCheckbox.isSelected());
    mLimitField.addActionListener(this);

    wrapper.add(mLimitCheckbox);
    wrapper.add(mLimitField);
    wrapper.add(new JPanel());
    parent.add(new JLabel());
    parent.add(wrapper);
}
 
Example 3
Source File: ReflectiveCustomizerProvider.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private JComponent createBooleanOption(OptionDescriptor option, Preferences prefs)  {
    JCheckBox checkBox = new JCheckBox();

    org.openide.awt.Mnemonics.setLocalizedText(checkBox, option.displayName);
    checkBox.setToolTipText(option.tooltip);
    checkBox.addActionListener(new ActionListenerImpl(option.preferencesKey, prefs));

    checkBox.setSelected(prefs.getBoolean(option.preferencesKey, 
            Boolean.TRUE == option.defaultValue));
    prefs.putBoolean(option.preferencesKey, checkBox.isSelected());
    GridBagConstraints constraints = new GridBagConstraints();

    constraints.anchor = GridBagConstraints.WEST;
    constraints.fill = GridBagConstraints.NONE;
    constraints.gridheight = 1;
    constraints.gridwidth = 2;
    constraints.gridx = 0;
    constraints.gridy = row++;
    constraints.weightx = 0;
    constraints.weighty = 0;

    add(checkBox, constraints);
    return checkBox;
}
 
Example 4
Source File: ScopeOptionsController.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void init() {
    btnTestFileNamePattern = new JButton();
    chkFileNameRegex = new JCheckBox();
    chkFileNameRegex.setToolTipText(UiUtils.getText(
            "BasicSearchForm.chkFileNameRegex.tooltip"));           //NOI18N

    if (!replacing) {
        chkArchives = new JCheckBox();
        chkGenerated = new JCheckBox();
    }
    chkUseIgnoreList = new JCheckBox();
    btnEditIgnoreList = new JButton();
    checkBoxListener = new CheckBoxListener();

    component.setLayout(new FlowLayout(FlowLayout.LEADING, 0, 0));
    setMnemonics();
    initIgnoreListControlComponents();
    initScopeOptionsRow(replacing);
    initInteraction();
}
 
Example 5
Source File: PluginQueryTokenizerPreferencesPanel.java    From bigtable-sql with Apache License 2.0 6 votes vote down vote up
private void addUseCustomQTCheckBox(JPanel panel, int col, int row)
{
	GridBagConstraints c = new GridBagConstraints();
	c.gridx = col;
	c.gridy = row;
	c.insets = new Insets(5, 5, 0, 0);
	c.anchor = GridBagConstraints.WEST;
	c.gridwidth = 2; // Span across two columns
	useCustomQTCheckBox = new JCheckBox(i18n.USE_CUSTOM_QT_LABEL);
	useCustomQTCheckBox.setName("useCustomQTCheckBox");

	// i18n[PreferencesPanel.useCustomQTToolTip=Gives enhanced capabilities
	// over the default query tokenizer for handling {0} scripts]
	String USE_CUSTOM_QT_TOOLTIP =
		s_stringMgr.getString("PreferencesPanel.useCustomQTToolTip", _databaseName);

	useCustomQTCheckBox.setToolTipText(USE_CUSTOM_QT_TOOLTIP);
	useCustomQTCheckBox.addActionListener(new UseQTHandler());
	panel.add(useCustomQTCheckBox, c);
}
 
Example 6
Source File: SettingsFrame.java    From FoxTelem with GNU General Public License v3.0 6 votes vote down vote up
private JCheckBox addCheckBoxRow(String name, String tip, boolean value, JPanel parent) {
	JCheckBox checkBox = new JCheckBox(name);
	checkBox.setEnabled(true);
	checkBox.addItemListener(this);
	checkBox.setToolTipText(tip);
	parent.add(checkBox);
	if (value) checkBox.setSelected(true); else checkBox.setSelected(false);
	return checkBox;
}
 
Example 7
Source File: ShelveChangesAction.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public HgShelveChangesSupport () {
    doBackupChxBox = new JCheckBox();
    org.openide.awt.Mnemonics.setLocalizedText(doBackupChxBox, org.openide.util.NbBundle.getMessage(ShelveChangesAction.class, "ShelvePanel.doBackupChxBox.text")); //NOI18N
    doBackupChxBox.setToolTipText(org.openide.util.NbBundle.getMessage(ShelveChangesAction.class, "ShelvePanel.doBackupChxBox.desc")); //NOI18N
    doBackupChxBox.getAccessibleContext().setAccessibleDescription(doBackupChxBox.getToolTipText());
    doBackupChxBox.setSelected(HgModuleConfig.getDefault().getBackupOnRevertModifications());
    doPurgeChxBox = new JCheckBox();
    org.openide.awt.Mnemonics.setLocalizedText(doPurgeChxBox, org.openide.util.NbBundle.getMessage(ShelveChangesAction.class, "ShelvePanel.doPurgeChxBox.text")); //NOI18N
    doPurgeChxBox.setToolTipText(org.openide.util.NbBundle.getMessage(ShelveChangesAction.class, "ShelvePanel.doPurgeChxBox.desc")); //NOI18N
    doPurgeChxBox.getAccessibleContext().setAccessibleDescription(doPurgeChxBox.getToolTipText());
    doPurgeChxBox.setSelected(HgModuleConfig.getDefault().isRemoveNewFilesOnRevertModifications());
    optionsPanel = new JPanel();
    optionsPanel.setLayout(new BoxLayout(optionsPanel, BoxLayout.Y_AXIS));
    optionsPanel.add(doBackupChxBox);
    optionsPanel.add(doPurgeChxBox);
}
 
Example 8
Source File: RevertModificationsPanel.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void initComponents() {
    org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(RevertModificationsPanel.class, "RevertModificationsPanel.infoLabel.text")); // NOI18N
    org.openide.awt.Mnemonics.setLocalizedText(jLabel2, org.openide.util.NbBundle.getMessage(RevertModificationsPanel.class, "RevertModificationsPanel.infoLabel2.text")); // NOI18N

    doBackupChxBox = new JCheckBox();
    org.openide.awt.Mnemonics.setLocalizedText(doBackupChxBox, org.openide.util.NbBundle.getMessage(RevertModificationsPanel.class, "RevertModificationsPanel.doBackupChxBox.text")); // NOI18N
    boolean doBackup = HgModuleConfig.getDefault().getBackupOnRevertModifications();
    doBackupChxBox.setSelected(doBackup);
    doPurgeChxBox = new JCheckBox();
    org.openide.awt.Mnemonics.setLocalizedText(doPurgeChxBox, org.openide.util.NbBundle.getMessage(RevertModificationsPanel.class, "RevertModificationsPanel.doPurgeChxBox.text")); // NOI18N
    doPurgeChxBox.setToolTipText(org.openide.util.NbBundle.getMessage(RevertModificationsPanel.class, "RevertModificationsPanel.doPurgeChxBox.desc")); // NOI18N
    doPurgeChxBox.getAccessibleContext().setAccessibleDescription(doPurgeChxBox.getToolTipText());
    boolean doPurge = HgModuleConfig.getDefault().isRemoveNewFilesOnRevertModifications();
    doPurgeChxBox.setSelected(doPurge);
    JPanel optionsPanel = new JPanel();
    optionsPanel.setLayout(new BoxLayout(optionsPanel, BoxLayout.Y_AXIS));
    optionsPanel.add(doBackupChxBox);
    optionsPanel.add(doPurgeChxBox);
    optionsPanel.setBorder(new javax.swing.border.EmptyBorder(0, 0, 0, 0));
    setOptionsPanel(optionsPanel, null);
}
 
Example 9
Source File: TabPanelConstruction.java    From mars-sim with GNU General Public License v3.0 5 votes vote down vote up
public void initializeUI() {
		uiDone = true;
		
		ConstructionManager manager = settlement.getConstructionManager();

		JPanel titlePanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
		topContentPanel.add(titlePanel);

		JLabel titleLabel = new JLabel(Msg.getString("TabPanelConstruction.label"), JLabel.CENTER); //$NON-NLS-1$
		titleLabel.setFont(new Font("Serif", Font.BOLD, 16));
		//titleLabel.setForeground(new Color(102, 51, 0)); // dark brown
		titlePanel.add(titleLabel);

		JPanel mainContentPanel = new JPanel(new GridLayout(2, 1));
		centerContentPanel.add(mainContentPanel, BorderLayout.CENTER);

		sitesPanel = new ConstructionSitesPanel(manager);
		mainContentPanel.add(sitesPanel);

		buildingsPanel = new ConstructedBuildingsPanel(manager);
		mainContentPanel.add(buildingsPanel);

		// Create bottom panel.
		JPanel bottomPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
//		bottomPanel.setBorder(new MarsPanelBorder());
		centerContentPanel.add(bottomPanel, BorderLayout.SOUTH);

		// Create override check box.
		overrideCheckbox = new JCheckBox(Msg.getString("TabPanelConstruction.checkbox.overrideConstructionAndSalvage")); //$NON-NLS-1$
		overrideCheckbox.setToolTipText(Msg.getString("TabPanelConstruction.tooltip.overrideConstructionAndSalvage")); //$NON-NLS-1$
		overrideCheckbox.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				setConstructionOverride(overrideCheckbox.isSelected());
			}
		});
		overrideCheckbox.setSelected(settlement.getConstructionOverride());
		bottomPanel.add(overrideCheckbox);
	}
 
Example 10
Source File: SkinSpecPanel.java    From megamek with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Used for BorderElements that have multiple entries, this method adds
 * a row of PathButton, Path text field, tiled checkbox and remove
 * button
 */
protected void addPathRow(String imgPath, boolean isTiled,
        boolean removeEnabled) {
    JButton newPathLbl = new JButton(
            Messages.getString("SkinEditor.Path")); //$NON-NLS-1$
    newPathLbl.setMargin(new Insets(1, 1, 1, 1));
    newPathLbl.setToolTipText(Messages.getString(
            "SkinEditor.PathToolTip", //$NON-NLS-1$
            new Object[] { Configuration.widgetsDir().getPath() }));
    newPathLbl.addActionListener(this);
    pathLbl.add(newPathLbl); //$NON-NLS-1$
    JTextField newPath = new JTextField(imgPath, TEXTFIELD_COLS);
    newPath.getDocument().addDocumentListener(this);
    path.add(newPath);
    JCheckBox newTiled = new JCheckBox(
            Messages.getString("SkinEditor.Tiled"), //$NON-NLS-1$
            isTiled);
    newTiled.setToolTipText(Messages
            .getString("SkinEditor.TiledToolTip")); //$NON-NLS-1$
    newTiled.addActionListener(this);
    tiled.add(newTiled);
    JButton newRemoveButton = new JButton(
            Messages.getString("SkinEditor.RemoveButton")); //$NON-NLS-1$
    newRemoveButton.setToolTipText(Messages
            .getString("SkinEditor.RemoveButtonToolTip")); //$NON-NLS-1$
    newRemoveButton.setMargin(new Insets(0, 0, 1, 0));
    newRemoveButton.setPreferredSize(new Dimension(14, 14));
    newRemoveButton.setMaximumSize(new Dimension(14, 14));
    newRemoveButton.setEnabled(removeEnabled);
    newRemoveButton.addActionListener(this);
    removeButtons.add(newRemoveButton);
}
 
Example 11
Source File: JPlagCreator.java    From jplag with GNU General Public License v3.0 5 votes vote down vote up
public static JCheckBox createCheckBox(String toolTip) {
	JCheckBox box = new JCheckBox();

	box.setFont(JPlagCreator.SYSTEM_FONT);
	box.setPreferredSize(new java.awt.Dimension(20, 20));
	box.setForeground(JPlagCreator.OPTION_PANEL_FOREGROUND);
	box.setBackground(JPlagCreator.SYSTEMCOLOR);
	if (toolTip != null && !toolTip.equals(""))
		box.setToolTipText(toolTip);
	return box;
}
 
Example 12
Source File: RoleSetPage.java    From ganttproject with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected,
    boolean cellHasFocus) {
  final RoleSet roleSet = (RoleSet) value;
  final JCheckBox result = new JCheckBox(myI18n.getRoleSetDisplayName(roleSet), roleSet.isEnabled());
  if (isTheOnlyEnabled(roleSet)) {
    result.setEnabled(false);
  }
  result.setToolTipText(createTooltipText(roleSet));
  return result;
}
 
Example 13
Source File: EditTeamService.java    From Shuffle-Move with GNU General Public License v3.0 4 votes vote down vote up
private Component makeUpperPanel() {
   JPanel ret = new JPanel(new GridBagLayout());
   GridBagConstraints c = new GridBagConstraints();
   c.fill = GridBagConstraints.HORIZONTAL;
   c.weightx = 1.0;
   c.weighty = 0.0;
   c.gridx = 1;
   c.gridy = 1;
   c.gridwidth = 1;
   c.gridheight = 1;
   
   c.gridx += 1;
   c.weightx = 0.0;
   JPanel typePanel = new JPanel();
   typePanel.add(new JLabel(getString(KEY_TYPE)));
   typeChooser = new TypeChooser(true);
   typePanel.add(typeChooser);
   typePanel.setToolTipText(getString(KEY_TYPE_TOOLTIP));
   typeChooser.setToolTipText(getString(KEY_TYPE_TOOLTIP));
   ret.add(typePanel, c);
   
   c.gridx += 1;
   c.weightx = 0.0;
   JPanel levelPanel = new JPanel();
   levelPanel.add(new JLabel(getString(KEY_LEVEL)));
   SpinnerNumberModel snm = new SpinnerNumberModel(0, 0, Species.MAX_LEVEL, 1);
   levelSpinner = new JSpinner(snm);
   levelPanel.add(levelSpinner);
   levelPanel.setToolTipText(getString(KEY_LEVEL_TOOLTIP));
   levelSpinner.setToolTipText(getString(KEY_LEVEL_TOOLTIP));
   ret.add(levelPanel, c);
   
   c.gridx += 1;
   c.weightx = 1.0;
   JPanel stringPanel = new JPanel(new GridBagLayout());
   GridBagConstraints sc = new GridBagConstraints();
   sc.fill = GridBagConstraints.HORIZONTAL;
   sc.gridx = 1;
   stringPanel.add(new JLabel(getString(KEY_NAME)), sc);
   textField = new JTextField();
   sc.gridx += 1;
   sc.weightx = 1.0;
   sc.insets = new Insets(0, 5, 0, 5);
   stringPanel.add(textField, sc);
   stringPanel.setToolTipText(getString(KEY_NAME_TOOLTIP));
   textField.setToolTipText(getString(KEY_NAME_TOOLTIP));
   ret.add(stringPanel, c);
   
   c.gridx += 1;
   c.weightx = 0.0;
   megaFilter = new JCheckBox(getString(KEY_MEGA_FILTER));
   megaFilter.setToolTipText(getString(KEY_MEGA_FILTER_TOOLTIP));;
   ret.add(megaFilter, c);
   
   c.gridx += 1;
   c.weightx = 0.0;
   effectFilter = new EffectChooser(false, EffectChooser.DefaultEntry.NO_FILTER);
   effectFilter.setToolTipText(getString(KEY_EFFECT_FILTER_TOOLTIP));
   ret.add(effectFilter, c);
   
   c.gridx += 1;
   c.weightx = 0.0;
   @SuppressWarnings("serial")
   JButton copyToLauncher = new JButton(new AbstractAction(getString(KEY_MAKE_DEFAULT)) {
      @Override
      public void actionPerformed(ActionEvent e) {
         makeTeamDefault();
      }
   });
   copyToLauncher.setToolTipText(getString(KEY_MAKE_DEFAULT_TOOLTIP));
   ret.add(copyToLauncher, c);
   
   getMinUpperPanel = new Supplier<Dimension>() {
      
      @Override
      public Dimension get() {
         Dimension ret = new Dimension(10 + 50, 0);
         for (Component c : new Component[] { typePanel, levelPanel, stringPanel, megaFilter, effectFilter,
               copyToLauncher }) {
            Dimension temp = c.getPreferredSize();
            int width = temp.width + ret.width;
            int height = Math.max(temp.height, ret.height);
            ret.setSize(width, height);
         }
         return ret;
      }
   };
   
   return ret;
}
 
Example 14
Source File: HonoSenderSamplerUI.java    From hono with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * Creates a new UI that provides means to configure
 * the southbound Telemetry &amp; Event API endpoint to connect to
 * for sending messages and an (optional) Device Registration service
 * endpoint for retrieving registration assertions.
 */
public HonoSenderSamplerUI() {

    honoServerOptions = new ServerOptionsPanel("Telemetry & Event Endpoint");
    tenant = new JLabeledTextField("Tenant");
    container = new JLabeledTextField("Name");
    endpoint = new JLabeledChoice("Endpoint",
            Stream.of(HonoSampler.Endpoint.values()).map(HonoSampler.Endpoint::name).toArray(String[]::new));
    endpoint.setToolTipText("<html>The name of the endpoint to send the AMQP message to.</html>");
    deviceId = new JLabeledTextField("Device ID");
    deviceId.setToolTipText("<html>The device identifier to put into the <em>device_id</em> application property of the AMQP message to send.</html>");
    contentType = new JLabeledTextField("Content type");
    data = new JLabeledTextArea("Message data");
    waitForDeliveryResult = new JCheckBox("Wait for delivery result");
    waitForDeliveryResult.setToolTipText("<html>Deselecting this option increases sender throughput, especially of <em>event</em> messages, " +
            "at the expense of not finding out about rejected messages. <br>For this, the number of messages at the receiver end has to be checked.</html>");
    setSenderTime = new JCheckBox("Set sender time in property");
    setSenderTime.setToolTipText(new StringBuilder()
            .append("<html>")
            .append("When checked, the messages being sent will contain a timestamp (millis since epoch start) ")
            .append("in the <em>timeStamp</em> application property.")
            .append("</html>")
            .toString());
    waitForReceivers = new JLabeledTextField(
            "Number of receivers to wait for (e.g. from other threads)");
    waitForReceiversTimeout = new JLabeledTextField(
            "Max time (millis) to wait for receivers");
    sampleSendTimeout = new JLabeledTextField("Max time (millis) for sending a message");
    msgCountPerSamplerRun = new JLabeledTextField("Number of messages per sampler run");

    addOption(honoServerOptions);
    addOption(tenant);
    addOption(container);
    addOption(getWrapperPanelToFixAlignment(endpoint));
    addOption(deviceId);
    addOption(contentType);
    addOption(data);
    addOption(waitForDeliveryResult);
    addOption(setSenderTime);
    addOption(waitForReceivers);
    addOption(waitForReceiversTimeout);
    addOption(sampleSendTimeout);
    addOption(msgCountPerSamplerRun);
}
 
Example 15
Source File: SearchPanel.java    From RegexReplacer with MIT License 4 votes vote down vote up
private void createComponent() {
	resultTableModel = new MyTableModel();
	resultTable = new JTable(resultTableModel);
	Enumeration<TableColumn> columns = resultTable.getColumnModel()
			.getColumns();
	for (int n = 0; columns.hasMoreElements(); n++) {
		columns.nextElement().setPreferredWidth(
				resultTableModel.getColumnWidth(n));
	}
	resultTable.setPreferredScrollableViewportSize(resultTable
			.getPreferredSize());
	resultTable.setAutoCreateRowSorter(false);
	// resultTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
	regexArea = new JTextArea(3, 20);
	replaceArea = new JTextArea(3, 20);

	unixLinesCkb = new JCheckBox("UNIX_LINES");
	unixLinesCkb.setToolTipText(Helper.UNIX_LINES_TIP);
	caseInsensitiveCkb = new JCheckBox("CASE_INSENSITIVE");
	caseInsensitiveCkb.setToolTipText(Helper.CASE_INSENSITIVE_TIP);
	commentsCkb = new JCheckBox("COMMENTS");
	commentsCkb.setToolTipText(Helper.COMMENTS_TIP);
	multilineCkb = new JCheckBox("MULTILINE");
	multilineCkb.setToolTipText(Helper.MULTILINE_TIP);
	literalCkb = new JCheckBox(StrUtils.getStr("SearchPanel.LITERAL"));
	literalCkb.setToolTipText(Helper.LITERAL_TIP);
	dotallCkb = new JCheckBox("DOTALL");
	dotallCkb.setToolTipText(Helper.DOTALL_TIP);
	unicodeCaseCkb = new JCheckBox("UNICODE_CASE");
	unicodeCaseCkb.setToolTipText(Helper.UNICODE_CASE_TIP);
	canonEqCkb = new JCheckBox("CANON_EQ");
	canonEqCkb.setToolTipText(Helper.CANON_EQ_TIP);

	expressionAvailable = new JCheckBox(
			StrUtils.getStr("SearchPanel.replaceFunction"), true);
	expressionAvailable.setToolTipText(StrUtils
			.getStr("SearchPanel.replaceFunction_tip"));
	liveUpdateCkb = new JCheckBox(
			StrUtils.getStr("SearchPanel.liveUpdate"), true);
	outputResultToNewWindow = new JCheckBox(
			StrUtils.getStr("SearchPanel.getReplacementOnly"));
	outputResultToNewWindow.setToolTipText(StrUtils
			.getStr("SearchPanel.getReplacementOnly_tip"));
	divertFocus = new JCheckBox(StrUtils.getStr("SearchPanel.returnFocus"),
			true);
	divertFocus.setToolTipText(StrUtils
			.getStr("SearchPanel.returnFocus_tip"));

	updateNowBtn = new JButton(StrUtils.getStr("SearchPanel.udpate"));
	updateNowBtn.setEnabled(false);
	replaceSelected = new JButton(
			StrUtils.getStr("SearchPanel.replaceSelected"));
	replaceAll = new JButton(StrUtils.getStr("SearchPanel.replaceAll"));
	statsLabel = new JLabel(StrUtils.getStr("SearchPanel.authorLabel"));
	matchResultLabel = new JLabel();
}
 
Example 16
Source File: ControlPanel.java    From openvisualtraceroute with GNU Lesser General Public License v3.0 4 votes vote down vote up
public SnifferControl() {
	super();
	setLayout(new FlowLayout(FlowLayout.LEFT, 2, 0));
	_hostIpTextField = new JTextField(17);
	_hostIpTextField.setText(Resources.getLabel("sniffer.host.tooltip"));
	final FirstInputListener listener = new FirstInputListener(_hostIpTextField);
	_hostIpTextField.addMouseListener(listener);
	_hostIpTextField.addKeyListener(listener);
	_hostIpTextField.setToolTipText(Resources.getLabel("sniffer.host.tooltip"));
	add(_hostIpTextField);

	final JLabel protocolLabel = new JLabel(Resources.getLabel("protocol.label"));
	protocolLabel.setToolTipText(Resources.getLabel("protocol.desc"));
	add(protocolLabel);
	for (final Protocol type : Protocol.values()) {
		if (type == Protocol.OTHER) {
			continue;
		}
		final JCheckBox check = new JCheckBox(type.name(), type == Protocol.TCP);
		_packets.put(type, check);
		add(check);
	}
	final JLabel portLabel = new JLabel(Resources.getLabel("port.label"));
	portLabel.setToolTipText(Resources.getLabel("port.desc"));
	_allPortCheck = new JCheckBox(Resources.getLabel("all.port.label"));
	_allPortCheck.setToolTipText(Resources.getLabel("all.port.desc"));
	_allPortCheck.setSelected(false);
	add(_allPortCheck);

	_portTF = new JFormattedTextField();
	_portTF.setText("80,443");
	_portTF.setColumns(15);
	//			_portTF.setMaximumSize(new Dimension(30, _portTF.getPreferredSize().height));
	add(portLabel);
	add(_portTF);
	_portTF.setEnabled(true);

	_allPortCheck.addChangeListener(e -> _portTF.setEnabled(!_allPortCheck.isSelected()));

	_filterPacketLengthCheck = new JCheckBox(Resources.getLabel("filter.length"));
	_filterPacketLengthCheck.setToolTipText(Resources.getLabel("filter.length.desc"));
	_filterPacketLengthCheck.setSelected(false);
	add(_filterPacketLengthCheck);

	_filterLengthTF = new JFormattedTextField(new NumberFormatterFactory());
	_filterLengthTF.setText("128");
	_filterLengthTF.setColumns(5);
	add(_filterLengthTF);

	_filterPacketLengthCheck.addChangeListener(e -> _filterLengthTF.setEnabled(_filterPacketLengthCheck.isEnabled() && _filterPacketLengthCheck.isSelected()));
	_capturePeriod = new JFormattedTextField(new NumberFormatterFactory());
	_capturePeriod.setText("0");
	_capturePeriod.setColumns(5);
	add(new JLabel(Resources.getLabel("capture.period")));
	add(_capturePeriod);

	_captureButton = new JButton(GO_IMG);
	_captureButton.setToolTipText(Resources.getLabel("capture.packet.start"));
	add(_captureButton);
	_captureButton.addActionListener(arg0 -> start());
}
 
Example 17
Source File: SwingCheckBoxListWidget.java    From atdl4j with MIT License 4 votes vote down vote up
@Override
public List< ? extends Component> createBrickComponents() {
  
  List<Component> components = new ArrayList<Component>();
  // wrapper
  JPanel wrapper = new JPanel();
  
  // tooltip
  String tooltip = control.getTooltip();
  
  // label
  if (control.getLabel() != null) {
    label = new JLabel();
    label.setName(getName() + "/label");
    label.setText(control.getLabel());
    if (tooltip != null)
      label.setToolTipText(tooltip);
    components.add(label);
  }
  
  if (((CheckBoxListT) control).getOrientation() != null
      && PanelOrientationT.VERTICAL.equals(((CheckBoxListT) control)
          .getOrientation())) {
    // TODO: NOT IMPLEMENTED
  }
  else {
    // TODO: NOT IMPLEMENTED
  }
  
  // checkBoxes
  List<ListItemT> listItems = ((CheckBoxListT) control).getListItem();
  for (ListItemT listItem : listItems) {
  
    JCheckBox checkBox = new JCheckBox();
    checkBox.setName(getName() + "/button/" + listItem.getEnumID());
  
    if (listItem.getUiRep() != null)
      checkBox.setText(listItem.getUiRep());
  
    if (parameter != null) {
      for (EnumPairT enumPair : parameter.getEnumPair()) {
        if (enumPair.getEnumID() == listItem.getEnumID()) {
  
          // set tooltip
          if (enumPair.getDescription() != null)
            checkBox.setToolTipText(enumPair.getDescription());
          else if (tooltip != null)
            checkBox.setToolTipText(tooltip);
          break;
        }
      }
    }
    else {
      if (tooltip != null)
        checkBox.setToolTipText(tooltip);
    }
    multiCheckBox.add(checkBox);
    components.add(checkBox);
  }
  
  // set initValue
  if (((CheckBoxListT) control).getInitValue() != null)
    setValue(((CheckBoxListT) control).getInitValue(), true);
  
  return components;
}
 
Example 18
Source File: AnalyzeDialog.java    From FancyBing with GNU General Public License v3.0 4 votes vote down vote up
private JComponent createLowerPanel()
{
    Box panel = Box.createVerticalBox();
    panel.add(GuiUtil.createFiller());
    m_comboBoxHistory = new JComboBox();
    panel.add(m_comboBoxHistory);
    Box lowerPanel = Box.createVerticalBox();
    lowerPanel.setBorder(GuiUtil.createEmptyBorder());
    panel.add(lowerPanel);
    Box optionsPanel = Box.createHorizontalBox();
    lowerPanel.add(optionsPanel);
    JPanel leftPanel = new JPanel();
    optionsPanel.add(leftPanel);
    Box leftBox = Box.createVerticalBox();
    leftPanel.add(leftBox);
    m_autoRun = new JCheckBox(i18n("LB_ANALYZE_AUTORUN"));
    m_autoRun.addItemListener(new ItemListener() {
            public void itemStateChanged(ItemEvent e) {
                if (! m_autoRun.isSelected())
                    m_listener.actionClearAnalyzeCommand();
            }
        });
    m_autoRun.setToolTipText(i18n("TT_ANALYZE_AUTORUN"));
    m_autoRun.setEnabled(false);
    leftBox.add(m_autoRun);
    m_clearBoard = new JCheckBox(i18n("LB_ANALYZE_CLEARBOARD"));
    m_clearBoard.setToolTipText(i18n("TT_ANALYZE_CLEARBOARD"));
    m_clearBoard.setEnabled(false);
    leftBox.add(m_clearBoard);
    m_clearBoard.setSelected(true);
    m_reuseWindow = new JCheckBox(i18n("LB_ANALYZE_REUSE_TEXT_WINDOW"));
    m_reuseWindow.setToolTipText(i18n("TT_ANALYZE_REUSE_TEXT_WINDOW"));
    leftBox.add(m_reuseWindow);
    JPanel rightPanel = new JPanel();
    rightPanel.add(createColorPanel());
    optionsPanel.add(rightPanel);

    // TODO: The following horizontal glue does not really work as expected
    // (tested on Linux/Sun Java 1.6.0_14) and the left two components in
    // the box are not aligned to the left.
    optionsPanel.add(Box.createHorizontalGlue());

    // TODO: If GTK Looks L&F is used on Linux/Sun Java 1.6.0_14 or OpenJDK
    // 6b14-1.4.1-0ubuntu11, then the text of the checkbox items can be
    // truncated a bit on the left (wrong minimum size calculation?). The
    // two fillers are a workaround for this.
    optionsPanel.add(GuiUtil.createFiller());
    optionsPanel.add(GuiUtil.createFiller());

    lowerPanel.add(createButtons());
    m_comboBoxHistory.addActionListener(this);
    return panel;
}
 
Example 19
Source File: SwingJideClockWidget.java    From atdl4j with MIT License 4 votes vote down vote up
@Override
protected List< ? extends Component> createBrickComponents() {
  
  List<Component> components = new ArrayList<Component>();
  
  // tooltip
     String tooltip = control.getTooltip();      
     
     if ( parameter instanceof UTCTimestampT || parameter instanceof TZTimestampT )
     {
             if (getAtdl4jOptions()==null||getAtdl4jOptions().isShowDateInputOnTimestampClockControl())
             {
                 showMonthYear = true;
                 showDay = true;
             } else {
                 showMonthYear = false;
                 showDay = false;
                 useNowAsDate = true;
             }
         showTime = true;
     }
     else if ( parameter instanceof UTCDateOnlyT || parameter instanceof LocalMktDateT )
     {
         showMonthYear = true;
         showDay = true;
         showTime = false;
     }
     else if ( parameter instanceof MonthYearT )
     {
         showMonthYear = true;
         showDay = false;
         showTime = false;
     }
     else if ( parameter == null || parameter instanceof UTCTimeOnlyT || parameter instanceof TZTimeOnlyT )
     {
         showMonthYear = false;
         showDay = false;
         showTime = true;
     }
     
     if ( getAtdl4jOptions() != null && 
         getAtdl4jOptions().isShowEnabledCheckboxOnOptionalClockControl() && 
         parameter != null && 
         UseT.OPTIONAL.equals( parameter.getUse() ) )
     {
         hasLabelOrCheckbox = true;
         enabledButton = new JCheckBox();
         enabledButton.setName(getName()+"/enablebutton");
         if (control.getLabel() != null) {
             enabledButton.setText(control.getLabel());
         }
         enabledButton.setToolTipText("Click to enable optional parameter");
         enabledButton.setSelected(false);
         enabledButton.addActionListener(new ActionListener() {
             public void actionPerformed(ActionEvent e) {
               updateFromView();                  
             }
         });
         components.add(enabledButton);
     }       
     else if (control.getLabel() != null)
     {
         // add label
         hasLabelOrCheckbox = true;
         label = new JLabel();
         label.setName(getName()+"/label");
         label.setText(control.getLabel());
         if (tooltip != null) label.setToolTipText(tooltip);
         components.add(label);
     }
     
     // date clock
     if (showMonthYear) {
         dateClock = new DateSpinner(showDay ? "dd.MM.yyyy" : "MM.yyyy");
         dateClock.setName(getName()+"/dateclock");
         if (tooltip != null) dateClock.setToolTipText(tooltip);
         components.add(dateClock);
     }
     // time clock
     if (showTime) {
         timeClock = new DateSpinner(show24HourClock ? "HH:mm:ss" : "hh:mm:ss");
         timeClock.setName(getName()+"/timeclock");
         if (tooltip != null) timeClock.setToolTipText(tooltip);
         components.add(timeClock);
     }

     // init value, if applicable
     setAndRenderInitValue( (XMLGregorianCalendar ) ControlHelper.getInitValue( control, getAtdl4jOptions() ), ((ClockT) control).getInitValueMode() );
     
     updateFromModel();
     return components;
}
 
Example 20
Source File: ForceGeneratorOptionsView.java    From megamek with GNU General Public License v2.0 4 votes vote down vote up
private JCheckBox createMissionRoleCheck(MissionRole role) {
    String key = "MissionRole." + role.toString().toLowerCase();
    JCheckBox chk = new JCheckBox(Messages.getString(key));
    chk.setToolTipText(Messages.getString(key + ".tooltip"));
    return chk;
}