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

The following examples show how to use javax.swing.JCheckBox#addItemListener() . 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: ViewElementBoolean.java    From Robot-Overlord-App with GNU General Public License v2.0 6 votes vote down vote up
public ViewElementBoolean(RobotOverlord ro,BooleanEntity e) {
	super(ro);
	this.e=e;
	
	e.addObserver(this);
	
	field = new JCheckBox();
	field.setSelected(e.get());
	field.addItemListener(this);
	field.setBorder(new EmptyBorder(0,0,0,0));
	field.addFocusListener(this);
	
	JLabel label=new JLabel(e.getName(),SwingConstants.LEFT);
	label.setLabelFor(field);
	
	panel.setLayout(new BorderLayout());
	panel.add(label,BorderLayout.LINE_START);
	panel.add(field,BorderLayout.LINE_END);
}
 
Example 2
Source File: Test4129681.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void init() {
    JCheckBox check = new JCheckBox("disable");
    check.addItemListener(this);

    this.label = new JLabel("message");
    this.label.setBorder(BorderFactory.createTitledBorder("label"));
    this.label.setEnabled(!check.isSelected());

    add(BorderLayout.NORTH, check);
    add(BorderLayout.CENTER, this.label);
}
 
Example 3
Source File: Test4129681.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void init() {
    JCheckBox check = new JCheckBox("disable");
    check.addItemListener(this);

    this.label = new JLabel("message");
    this.label.setBorder(BorderFactory.createTitledBorder("label"));
    this.label.setEnabled(!check.isSelected());

    add(BorderLayout.NORTH, check);
    add(BorderLayout.CENTER, this.label);
}
 
Example 4
Source File: PCGenFrame.java    From pcgen with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public Boolean maybeShowWarningConfirm(String title, String message, String checkBoxText,
	final PropertyContext context, final String contextProp)
{
	if (!context.getBoolean(contextProp, true))
	{
		return null;
	}
	final JCheckBox checkBox = new JCheckBox(checkBoxText, true);
	checkBox.addItemListener(e -> context.setBoolean(contextProp, checkBox.isSelected()));
	JPanel panel = buildMessageLabelPanel(message, checkBox);
	int ret = JOptionPane.showConfirmDialog(this, panel, title, JOptionPane.YES_NO_OPTION,
		JOptionPane.WARNING_MESSAGE);
	return ret == JOptionPane.YES_OPTION;
}
 
Example 5
Source File: Test4129681.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void init() {
    JCheckBox check = new JCheckBox("disable");
    check.addItemListener(this);

    this.label = new JLabel("message");
    this.label.setBorder(BorderFactory.createTitledBorder("label"));
    this.label.setEnabled(!check.isSelected());

    add(BorderLayout.NORTH, check);
    add(BorderLayout.CENTER, this.label);
}
 
Example 6
Source File: WebDriverConfigGui.java    From jmeter-plugins-webdriver with Apache License 2.0 5 votes vote down vote up
private void createManualProxy(JPanel panel, ButtonGroup group) {
    manualProxy = new JRadioButton("Manual proxy configuration");
    group.add(manualProxy);
    panel.add(manualProxy);

    manualProxy.addItemListener(this);

    JPanel manualPanel = new VerticalPanel();
    manualPanel.setBorder(BorderFactory.createEmptyBorder(0, PROXY_FIELD_INDENT, 0, 0));

    httpProxyHost = new JTextField();
    httpProxyPort = new JFormattedTextField(NUMBER_FORMAT);
    httpProxyPort.setText(String.valueOf(DEFAULT_PROXY_PORT));
    manualPanel.add(createProxyHostAndPortPanel(httpProxyHost, httpProxyPort, "HTTP Proxy:"));
    useHttpSettingsForAllProtocols = new JCheckBox("Use HTTP proxy server for all protocols");
    useHttpSettingsForAllProtocols.setSelected(true);
    useHttpSettingsForAllProtocols.setEnabled(false);
    useHttpSettingsForAllProtocols.addItemListener(this);
    manualPanel.add(useHttpSettingsForAllProtocols);

    httpsProxyHost = new JTextField();
    httpsProxyPort = new JFormattedTextField(NUMBER_FORMAT);
    httpsProxyPort.setText(String.valueOf(DEFAULT_PROXY_PORT));
    manualPanel.add(createProxyHostAndPortPanel(httpsProxyHost, httpsProxyPort, "SSL Proxy:"));

    ftpProxyHost = new JTextField();
    ftpProxyPort = new JFormattedTextField(NUMBER_FORMAT);
    ftpProxyPort.setText(String.valueOf(DEFAULT_PROXY_PORT));
    manualPanel.add(createProxyHostAndPortPanel(ftpProxyHost, ftpProxyPort, "FTP Proxy:"));

    socksProxyHost = new JTextField();
    socksProxyPort = new JFormattedTextField(NUMBER_FORMAT);
    socksProxyPort.setText(String.valueOf(DEFAULT_PROXY_PORT));
    manualPanel.add(createProxyHostAndPortPanel(socksProxyHost, socksProxyPort, "SOCKS Proxy:"));

    manualPanel.add(createNoProxyPanel());

    panel.add(manualPanel);
}
 
Example 7
Source File: Test4129681.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void init() {
    JCheckBox check = new JCheckBox("disable");
    check.addItemListener(this);

    this.label = new JLabel("message");
    this.label.setBorder(BorderFactory.createTitledBorder("label"));
    this.label.setEnabled(!check.isSelected());

    add(BorderLayout.NORTH, check);
    add(BorderLayout.CENTER, this.label);
}
 
Example 8
Source File: EditSettingsControlPanel.java    From VanetSim with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Creates the panel which is shown when beacon sending is enabled.
 * 
 * @return the beacon panel
 */
private final JPanel createBeaconPanel(){
	JPanel panel = new JPanel();
	panel.setOpaque(false);
	panel.setLayout(new GridBagLayout());
	
	GridBagConstraints c = new GridBagConstraints();
	c.fill = GridBagConstraints.BOTH;
	c.anchor = GridBagConstraints.PAGE_START;
	c.weightx = 1;
	c.gridx = 0;
	c.gridy = 0;
	c.gridheight = 1;
	c.insets = new Insets(5,0,5,0);
	
	JLabel jLabel1 = new JLabel(Messages.getString("EditSettingsControlPanel.beaconInterval")); //$NON-NLS-1$
	panel.add(jLabel1,c);		
	beaconInterval_ = new JFormattedTextField(NumberFormat.getIntegerInstance());
	beaconInterval_.setPreferredSize(new Dimension(60,20));
	beaconInterval_.setValue(240);
	beaconInterval_.addPropertyChangeListener("value", this); //$NON-NLS-1$
	c.gridx = 1;
	c.weightx = 0;
	panel.add(beaconInterval_,c);
	
	
	c.gridx = 0;
	c.gridwidth = 2;
	++c.gridy;
	globalInfrastructureCheckBox_ = new JCheckBox(Messages.getString("EditSettingsControlPanel.enableInfrastructure"), true); //$NON-NLS-1$
	globalInfrastructureCheckBox_.addItemListener(this);
	// Disabled as it's not yet implemented
	// beaconPanel_.add(globalInfrastructureCheckBox_,c);
	
	return panel;
}
 
Example 9
Source File: Test4129681.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void init() {
    JCheckBox check = new JCheckBox("disable");
    check.addItemListener(this);

    this.label = new JLabel("message");
    this.label.setBorder(BorderFactory.createTitledBorder("label"));
    this.label.setEnabled(!check.isSelected());

    add(BorderLayout.NORTH, check);
    add(BorderLayout.CENTER, this.label);
}
 
Example 10
Source File: MultiMSMSWindow.java    From mzmine3 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Create the frame.
 */
public MultiMSMSWindow() {
  setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
  setBounds(100, 100, 853, 586);
  contentPane = new JPanel();
  contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
  contentPane.setLayout(new BorderLayout(0, 0));
  setContentPane(contentPane);

  pnTopMenu = new JPanel(new FlowLayout(FlowLayout.LEFT, 5, 0));
  contentPane.add(pnTopMenu, BorderLayout.NORTH);

  prevRaw = new JButton("<");
  pnTopMenu.add(prevRaw);
  prevRaw.addActionListener(e -> {
    prevRaw();
  });

  nextRaw = new JButton(">");
  pnTopMenu.add(nextRaw);
  nextRaw.addActionListener(e -> {
    nextRaw();
  });

  lbRawIndex = new JLabel("");
  pnTopMenu.add(lbRawIndex);
  lbRawName = new JLabel("");
  pnTopMenu.add(lbRawName);

  cbBestRaw = new JCheckBox("use best for each");
  pnTopMenu.add(cbBestRaw);
  cbBestRaw.addItemListener(e -> {
    setAlwaysShowBest(cbBestRaw.isSelected());
  });

  cbUseBestForMissingRaw = new JCheckBox("use best missing raw");
  pnTopMenu.add(cbUseBestForMissingRaw);
  cbUseBestForMissingRaw.addItemListener(e -> {
    setUseBestForMissing(cbUseBestForMissingRaw.isSelected());
  });

  pnCharts = new JPanel();
  contentPane.add(pnCharts, BorderLayout.CENTER);
  pnCharts.setLayout(new GridLayout(0, 4));

  addMenu();
}
 
Example 11
Source File: UwExperimentTab.java    From FoxTelem with GNU General Public License v3.0 4 votes vote down vote up
public UwExperimentTab(FoxSpacecraft sat, int displayType)  {
	super();
	fox = sat;
	foxId = fox.foxId;
	NAME = fox.toString() + " CAN PACKETS";
	
	int j = 0;
	layout = new BitArrayLayout[ids.length];
	 for (int canid : ids)
		 layout[j++] = Config.satManager.getLayoutByCanId(6, canid);

	splitPaneHeight = Config.loadGraphIntValue(fox.getIdString(), GraphFrame.SAVED_PLOT, FoxFramePart.TYPE_REAL_TIME, UWTAB, "splitPaneHeight");
	
	lblName = new JLabel(NAME);
	lblName.setMaximumSize(new Dimension(1600, 20));
	lblName.setMinimumSize(new Dimension(1600, 20));
	lblName.setFont(new Font("SansSerif", Font.BOLD, 14));
	topPanel.add(lblName);
	
	lblFramesDecoded = new JLabel(DECODED + CAN_DECODED);
	lblFramesDecoded.setFont(new Font("SansSerif", Font.BOLD, 14));
	lblFramesDecoded.setBorder(new EmptyBorder(5, 2, 5, 5) );
	topPanel.add(lblFramesDecoded);

	healthPanel = new JPanel();
	
	healthPanel.setLayout(new BoxLayout(healthPanel, BoxLayout.Y_AXIS));
	healthPanel.setBorder(new SoftBevelBorder(BevelBorder.LOWERED, null, null, null, null));
	healthPanel.setBackground(Color.DARK_GRAY);
	
	topHalfPackets = new JPanel(); 
	topHalfPackets.setBackground(Color.DARK_GRAY);
	bottomHalfPackets = new JPanel(); //new ImagePanel("C:/Users/chris.e.thompson/Desktop/workspace/SALVAGE/data/stars5.png");
	bottomHalfPackets.setBackground(Color.DARK_GRAY);
	healthPanel.add(topHalfPackets);
	healthPanel.add(bottomHalfPackets);

	initDisplayHalves(healthPanel);
	
	centerPanel = new JPanel();
	centerPanel.setLayout(new BoxLayout(centerPanel, BoxLayout.X_AXIS));

	addModules();
	
	splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT,
			healthPanel, centerPanel);
	splitPane.setOneTouchExpandable(true);
	splitPane.setContinuousLayout(true); // repaint as we resize, otherwise we can not see the moved line against the dark background
	if (splitPaneHeight != 0) 
		splitPane.setDividerLocation(splitPaneHeight);
	else
		splitPane.setDividerLocation(DEFAULT_DIVIDER_LOCATION);
	
	SplitPaneUI spui = splitPane.getUI();
    if (spui instanceof BasicSplitPaneUI) {
      // Setting a mouse listener directly on split pane does not work, because no events are being received.
      ((BasicSplitPaneUI) spui).getDivider().addMouseListener(new MouseAdapter() {
          public void mouseReleased(MouseEvent e) {
        	  splitPaneHeight = splitPane.getDividerLocation();
        	  Log.println("SplitPane: " + splitPaneHeight);
      		Config.saveGraphIntParam(fox.getIdString(), GraphFrame.SAVED_PLOT, FoxFramePart.TYPE_REAL_TIME, UWTAB, "splitPaneHeight", splitPaneHeight);
          }
      });
    }
	//Provide minimum sizes for the two components in the split pane
	Dimension minimumSize = new Dimension(100, 50);
	healthPanel.setMinimumSize(minimumSize);
	centerPanel.setMinimumSize(minimumSize);
	add(splitPane, BorderLayout.CENTER);
			
	showRawBytes = new JCheckBox("Show Raw Bytes", Config.displayRawRadData);
	bottomPanel.add(showRawBytes );
	showRawBytes.addItemListener(this);
	

	addBottomFilter();
	
	radTableModel = new CanPacketRawTableModel();
	radPacketTableModel = new CanPacketTableModel();
	addTables(radTableModel,radPacketTableModel);

	addPacketModules();
	topHalfPackets.setVisible(false);
	bottomHalfPackets.setVisible(false);
	
	// initial populate
	parseRadiationFrames();
}
 
Example 12
Source File: AlignmentPanel.java    From AML-Project with Apache License 2.0 4 votes vote down vote up
/**
 * Refreshes the AlignmentReviewer
 */
public void refresh()
{
	dialogPanel = new JPanel();
	dialogPanel.setLayout(new BoxLayout(dialogPanel, BoxLayout.PAGE_AXIS));
	if(aml.hasAlignment())
	{
		//The header button panel
		selectAll = new JCheckBox("Select All/None");
		selectAll.addItemListener(this);
		setCorrect = new JButton("Set Correct");
		setCorrect.setBackground(AMLColor.GREEN);
		setCorrect.setPreferredSize(new Dimension(110,28));
		setCorrect.addActionListener(this);
		reset = new JButton("Reset");
		reset.setBackground(AMLColor.GRAY);
		reset.setPreferredSize(new Dimension(110,28));
		reset.addActionListener(this);
		setIncorrect = new JButton("Set Incorrect");
		setIncorrect.setBackground(AMLColor.RED);
		setIncorrect.setPreferredSize(new Dimension(110,28));
		setIncorrect.addActionListener(this);
		sortAsc = new JButton("Sort \u2191");
		sortAsc.setPreferredSize(new Dimension(110,28));
		sortAsc.addActionListener(this);
		sortDes = new JButton("Sort \u2193");
		sortDes.setPreferredSize(new Dimension(110,28));
		sortDes.addActionListener(this);
		search = new JButton("Search");
		search.setPreferredSize(new Dimension(110,28));
		search.addActionListener(this);
		headerPanel = new JPanel(new FlowLayout());
		headerPanel.setMaximumSize(new Dimension(headerPanel.getMaximumSize().width,30));
		JPanel left = new JPanel();
		left.setBorder(new BevelBorder(1));
		left.add(selectAll);
		left.add(setCorrect);
		left.add(reset);
		left.add(setIncorrect);
		headerPanel.add(left);
		JPanel right = new JPanel();
		right.setBorder(new BevelBorder(1));
		right.add(sortAsc);
		right.add(sortDes);
		right.add(search);
		headerPanel.add(right);
		
		//The mapping list
		mappingPanel = new JPanel(new GridLayout(0,1));
		a = aml.getAlignment();
		check = new Vector<JCheckBox>();
		mappings = new Vector<MappingButton>(a.size());
		mappingPanel.setMaximumSize(new Dimension(mappingPanel.getMaximumSize().width,a.size()*30));
		for(Mapping m : a)
		{
			JCheckBox c = new JCheckBox(""); 
			check.add(c);
			MappingButton b = new MappingButton(m);
			mappings.add(b);
			b.addActionListener(this);
			JPanel subPanel = new JPanel(new BorderLayout());
			subPanel.add(c,BorderLayout.LINE_START);
			JPanel subSubPanel = new JPanel(new BorderLayout());
			subSubPanel.add(b,BorderLayout.LINE_START);
			subPanel.add(subSubPanel, BorderLayout.CENTER);
			subPanel.setMaximumSize(new Dimension(subPanel.getMaximumSize().width,28));
			subPanel.setPreferredSize(new Dimension(subPanel.getPreferredSize().width,28));
			mappingPanel.add(subPanel);
		}
		JPanel alignment = new JPanel();
		alignment.setLayout(new BoxLayout(alignment, BoxLayout.PAGE_AXIS));
		alignment.add(mappingPanel);
		JPanel filler = new JPanel();
		alignment.add(filler);
		scrollPane = new JScrollPane(alignment);
		scrollPane.setBorder(new BevelBorder(1));
		scrollPane.getVerticalScrollBar().setUnitIncrement(28);
		scrollPane.setBackground(AMLColor.WHITE);
		dialogPanel.add(headerPanel);
		dialogPanel.add(scrollPane);
	}
	setContentPane(dialogPanel);
	dialogPanel.revalidate();
	dialogPanel.repaint();
	this.pack();
	this.setVisible(true);
}
 
Example 13
Source File: BuckSettingsUI.java    From buck with Apache License 2.0 4 votes vote down vote up
private JPanel initInstallSettingsSection() {
  runAfterInstall = new JCheckBox("Run after install (-r)");
  multiInstallMode = new JCheckBox("Multi-install mode (-x)");
  uninstallBeforeInstall = new JCheckBox("Uninstall before installing (-u)");
  customizedInstallSetting = new JCheckBox("Use customized install setting:  ");
  customizedInstallSettingField = new JBTextField();
  customizedInstallSettingField.getEmptyText().setText(CUSTOMIZED_INSTALL_FLAGS_HINT);
  customizedInstallSettingField.setEnabled(false);

  JPanel panel = new JPanel(new GridBagLayout());
  panel.setBorder(IdeBorderFactory.createTitledBorder("Install Settings", true));

  GridBagConstraints leftSide = new GridBagConstraints();
  leftSide.fill = GridBagConstraints.NONE;
  leftSide.anchor = GridBagConstraints.LINE_START;
  leftSide.gridx = 0;
  leftSide.weightx = 0;

  GridBagConstraints rightSide = new GridBagConstraints();
  rightSide.fill = GridBagConstraints.HORIZONTAL;
  rightSide.anchor = GridBagConstraints.LINE_START;
  leftSide.gridx = 1;
  rightSide.weightx = 1;

  leftSide.gridy = rightSide.gridy = 0;
  panel.add(runAfterInstall, leftSide);

  leftSide.gridy = rightSide.gridy = 1;
  panel.add(multiInstallMode, leftSide);

  leftSide.gridy = rightSide.gridy = 2;
  panel.add(uninstallBeforeInstall, leftSide);

  leftSide.gridy = rightSide.gridy = 3;
  panel.add(customizedInstallSetting, leftSide);
  panel.add(customizedInstallSettingField, rightSide);

  customizedInstallSetting.addItemListener(
      e -> {
        if (e.getStateChange() == ItemEvent.SELECTED) {
          customizedInstallSettingField.setEnabled(true);
          runAfterInstall.setEnabled(false);
          multiInstallMode.setEnabled(false);
          uninstallBeforeInstall.setEnabled(false);
        } else {
          customizedInstallSettingField.setEnabled(false);
          runAfterInstall.setEnabled(true);
          multiInstallMode.setEnabled(true);
          uninstallBeforeInstall.setEnabled(true);
        }
      });
  return panel;
}
 
Example 14
Source File: Main_BottomToolbar.java    From Hotel-Properties-Management-System with GNU General Public License v2.0 4 votes vote down vote up
public Main_BottomToolbar() {

        toolBar = new JToolBar();
        toolBar.setAlignmentX(Component.LEFT_ALIGNMENT);
        toolBar.setAlignmentY(Component.BOTTOM_ALIGNMENT);
        toolBar.setPreferredSize(new Dimension(1200, 25));
        toolBar.setMinimumSize(new Dimension(800, 25));
        toolBar.setAutoscrolls(true);
        toolBar.setFloatable(false);
        toolBar.setRollover(true);

        userIconLabel = new JLabel(new ImageIcon(getClass().getResource("/com/coder/hms/icons/main_user.png")));
        toolBar.add(userIconLabel);

        //initialize weather api for use.
        liveWeather = new GetLiveWeather();
        
        userLabel = new JLabel();
        userLabel.setMaximumSize(new Dimension(160, 19));
        userLabel.setFont(new Font("Microsoft Sans Serif", Font.PLAIN, 13));
        userLabel.setHorizontalTextPosition(SwingConstants.CENTER);
        userLabel.setHorizontalAlignment(SwingConstants.LEFT);
        toolBar.add(userLabel);
        toolBar.addSeparator();

        dateIconLabel = new JLabel(new ImageIcon(getClass().getResource("/com/coder/hms/icons/main_calendar.png")));
        toolBar.add(dateIconLabel);

        dateLabel = new JLabel("");
        dateLabel.setMaximumSize(new Dimension(160, 19));
        dateLabel.setHorizontalTextPosition(SwingConstants.CENTER);
        dateLabel.setHorizontalAlignment(SwingConstants.LEFT);
        dateLabel.setFont(new Font("Microsoft Sans Serif", Font.PLAIN, 13));
        toolBar.add(dateLabel);
        toolBar.addSeparator();

        currencyUsdIcon = new JLabel(new ImageIcon(getClass().getResource("/com/coder/hms/icons/main_currency.png")));
        toolBar.add(currencyUsdIcon);

        currencyUsdLabel = new JLabel("");
        currencyUsdLabel.setMaximumSize(new Dimension(160, 19));
        currencyUsdLabel.setHorizontalTextPosition(SwingConstants.CENTER);
        currencyUsdLabel.setHorizontalAlignment(SwingConstants.LEFT);
        currencyUsdLabel.setFont(new Font("Microsoft Sans Serif", Font.PLAIN, 13));
        toolBar.add(currencyUsdLabel);
        toolBar.addSeparator();

        currencyEuroIcon = new JLabel(new ImageIcon(getClass().getResource("/com/coder/hms/icons/main_currency_euro.png")));
        toolBar.add(currencyEuroIcon);

        currencyEuroLabel = new JLabel("");
        currencyEuroLabel.setMaximumSize(new Dimension(160, 19));
        currencyEuroLabel.setHorizontalTextPosition(SwingConstants.CENTER);
        currencyEuroLabel.setHorizontalAlignment(SwingConstants.LEFT);
        currencyEuroLabel.setFont(new Font("Microsoft Sans Serif", Font.PLAIN, 13));
        toolBar.add(currencyEuroLabel);
        toolBar.addSeparator();

        currencyPoundIcon = new JLabel(new ImageIcon(getClass().getResource("/com/coder/hms/icons/main_currency_pound.png")));
        toolBar.add(currencyPoundIcon);

        currencyPoundLabel = new JLabel("");
        currencyPoundLabel.setMaximumSize(new Dimension(160, 19));
        currencyPoundLabel.setHorizontalTextPosition(SwingConstants.CENTER);
        currencyPoundLabel.setHorizontalAlignment(SwingConstants.LEFT);
        currencyPoundLabel.setFont(new Font("Microsoft Sans Serif", Font.PLAIN, 13));
        toolBar.add(currencyPoundLabel);
        toolBar.addSeparator();

        hotelIconLabel = new JLabel(new ImageIcon(getClass().getResource("/com/coder/hms/icons/login_hotel.png")));
        toolBar.add(hotelIconLabel);

        hotelNameLabel = new JLabel("");
        hotelNameLabel.setMaximumSize(new Dimension(160, 19));
        hotelNameLabel.setHorizontalTextPosition(SwingConstants.CENTER);
        hotelNameLabel.setHorizontalAlignment(SwingConstants.LEFT);
        hotelNameLabel.setFont(new Font("Microsoft Sans Serif", Font.PLAIN, 13));
        toolBar.add(hotelNameLabel);
        toolBar.addSeparator();

        checkBox = new JCheckBox("");
        checkBox.setToolTipText("Enable local weather");
        checkBox.addItemListener(showWeather());
        toolBar.add(checkBox);

        weatherIconLabel = new JLabel(new ImageIcon(getClass().getResource("/com/coder/hms/icons/toolbar_weather.png")));
        toolBar.add(weatherIconLabel);

        weatherLabel = new JLabel("");
        weatherLabel.setPreferredSize(new Dimension(160, 19));
        weatherLabel.setHorizontalTextPosition(SwingConstants.CENTER);
        weatherLabel.setHorizontalAlignment(SwingConstants.LEFT);
        weatherLabel.setFont(new Font("Microsoft Sans Serif", Font.PLAIN, 13));
        weatherLabel.setEnabled(false);
        toolBar.add(weatherLabel);

    }
 
Example 15
Source File: AutoSavePanel.java    From netbeans with Apache License 2.0 4 votes vote down vote up
/**
 * This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The
 * content of this method is always regenerated by the Form Editor.
 */

// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {

    chkUseFeature = new JCheckBox();
    chkSaveOnFocusLost = new JCheckBox();
    spnMinutes = new JSpinner();
    jLabel2 = new JLabel();

    Mnemonics.setLocalizedText(chkUseFeature, NbBundle.getMessage(AutoSavePanel.class, "AutoSavePanel.jLabel1.text")); // NOI18N
    chkUseFeature.setActionCommand(NbBundle.getMessage(AutoSavePanel.class, "AutoSavePanel.chkUseFeature.actionCommand")); // NOI18N
    chkUseFeature.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent evt) {
            chkUseFeatureItemStateChanged(evt);
        }
    });

    Mnemonics.setLocalizedText(chkSaveOnFocusLost, NbBundle.getMessage(AutoSavePanel.class,"AutoSavePanel.chkSaveOnFocusLost.text")); // NOI18N

    spnMinutes.setModel(this.spnModel);
    spnMinutes.setToolTipText(NbBundle.getMessage(AutoSavePanel.class, "AutoSavePanel.spnMinutes.toolTipText")); // NOI18N

    Mnemonics.setLocalizedText(jLabel2, NbBundle.getMessage(AutoSavePanel.class, "AutoSavePanel.jLabel2.text")); // NOI18N

    GroupLayout layout = new GroupLayout(this);
    this.setLayout(layout);
    layout.setHorizontalGroup(layout.createParallelGroup(Alignment.LEADING)
        .addGroup(layout.createSequentialGroup()
            .addContainerGap()
            .addGroup(layout.createParallelGroup(Alignment.LEADING)
                .addComponent(chkSaveOnFocusLost)
                .addGroup(layout.createSequentialGroup()
                    .addComponent(chkUseFeature)
                    .addPreferredGap(ComponentPlacement.RELATED)
                    .addComponent(spnMinutes, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(ComponentPlacement.RELATED)
                    .addComponent(jLabel2)))
            .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
    );
    layout.setVerticalGroup(layout.createParallelGroup(Alignment.LEADING)
        .addGroup(layout.createSequentialGroup()
            .addContainerGap()
            .addGroup(layout.createParallelGroup(Alignment.BASELINE)
                .addComponent(chkUseFeature)
                .addComponent(spnMinutes, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addComponent(jLabel2))
            .addPreferredGap(ComponentPlacement.RELATED)
            .addComponent(chkSaveOnFocusLost)
            .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
    );
}
 
Example 16
Source File: InjectParametersDialog.java    From rapidminer-studio with GNU Affero General Public License v3.0 4 votes vote down vote up
/**
 * Set the content of the scrollpane aka parameterPanel.
 */
private void fillParameterPanel() {
	parameterPanel.removeAll();

	final ValueProvider[] valueProviders = data.getValueProviders().toArray(new ValueProvider[0]);

	GridBagConstraints gbc = new GridBagConstraints();
	gbc.insets = new Insets(10, 10, 0, 0);
	gbc.gridx = 0;
	gbc.gridy = 0;
	gbc.anchor = GridBagConstraints.NORTHWEST;
	gbc.fill = GridBagConstraints.HORIZONTAL;
	List<ConnectionParameterModel> filteredParameters = getFilteredParameters();
	for (ConnectionParameterModel parameter : filteredParameters) {
		ExtendedJComboBox<String> selectBox = new ExtendedJComboBox<>(new String[]{I18N.getGUIMessage("gui.dialog.inject_connection.select")});
		selectBox.setEnabled(false);
		selectBox.setVisible(!parameter.isInjected());
		selectBox.setPreferredWidth(COMBOBOX_WIDTH);
		selectBox.setRenderer(EMPTY_DEFAULT_LIST_CELL_RENDERER);

		ExtendedJComboBox<ValueProvider> comboBox;
		comboBox = new ExtendedJComboBox<>(valueProviders);
		if (parameter.getInjectorName() != null) {
			Optional<ValueProvider> optionalValueProvider = Arrays.stream(valueProviders).filter(vp -> vp.getName().equals(parameter.getInjectorName())).findFirst();
			optionalValueProvider.ifPresent(comboBox::setSelectedItem);
		}
		comboBox.setEnabled(parameter.isEditable());
		comboBox.setVisible(parameter.isInjected());
		comboBox.setPreferredWidth(COMBOBOX_WIDTH);
		comboBox.addActionListener(a -> {
			final ValueProvider selectedItem = (ValueProvider) comboBox.getSelectedItem();
			if (selectedItem != null) {
				parameter.setInjectorName(selectedItem.getName());
			}
			checkAndShowWarning();
		});
		comboBox.setRenderer(new ValueProviderRenderer(parameter, wellConfiguredVps));

		gbc.anchor = GridBagConstraints.WEST;
		gbc.gridx = 0;
		gbc.weightx = 0;
		final JCheckBox checkBox = new JCheckBox(ConnectionI18N.getParameterName(type, parameter.getGroupName(), parameter.getName(), parameter.getName()));
		checkBox.setSelected(parameter.isInjected());
		checkBox.setEnabled(parameter.isEditable());
		checkBox.setToolTipText(I18N.getGUILabel("connection.valueprovider.key_for_injection.label", parameter.getName()));
		checkBox.addItemListener(e -> {
			final boolean injected = e.getStateChange() == ItemEvent.SELECTED;
			String name = setParameterInjected(parameter, injected);
			selectBox.setVisible(!injected);
			if (injected && name != null) {
				comboBox.setSelectedIndex(DEFAULT_VALUE_PROVIDER_INDEX);
			}
			comboBox.setVisible(injected);
			checkAndShowWarning();
		});
		parameterPanel.add(checkBox, gbc);

		gbc.anchor = GridBagConstraints.CENTER;
		gbc.weightx = 1;
		gbc.gridx++;
		gbc.fill = GridBagConstraints.HORIZONTAL;
		parameterPanel.add(new JLabel(), gbc);
		gbc.gridx++;
		gbc.weightx = 0;
		gbc.fill = GridBagConstraints.NONE;
		int oldri = gbc.insets.right;
		gbc.insets.right = 16;
		parameterPanel.add(comboBox, gbc);
		parameterPanel.add(selectBox, gbc);
		gbc.insets.right = oldri;
		gbc.gridy++;
	}

	if (filteredParameters.isEmpty()) {
		if (data.getParameters().size() > filteredParameters.size()) {
			parameterPanel.add(new JLabel(I18N.getGUIMessage("gui.dialog.inject_connection_parameter.no_results.label"), NO_RESULTS_ICON, SwingConstants.LEFT), gbc);
		} else {
			parameterPanel.add(new JLabel(I18N.getGUIMessage("gui.dialog.inject_connection_parameter.no_parameters.label"), NO_RESULTS_ICON, SwingConstants.LEFT), gbc);
		}
	}

	gbc.weighty = 1;
	parameterPanel.add(new JLabel(), gbc);
	revalidate();
	repaint();
}
 
Example 17
Source File: MarkOccurencesPanel.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private void addListeners() {
    ItemListener itemListener = new CheckItemListener();
    for (JCheckBox box : boxes) {
        box.addItemListener(itemListener);
    }
}
 
Example 18
Source File: LoggerViewPanel.java    From MtgDesktopCompanion with GNU General Public License v3.0 4 votes vote down vote up
public LoggerViewPanel() {
	model = new LogTableModel();
	cboChooseLevel = UITools.createCombobox(new Level[] {null, Level.INFO, Level.ERROR, Level.DEBUG, Level.TRACE });
	JPanel panel = new JPanel();
	table = new JXTable(model);
	btnRefresh = new JButton(MTGConstants.ICON_REFRESH);
	t = new Timer(1000, e -> model.fireTableDataChanged());
	chckbxAutorefresh = new JCheckBox("Auto-refresh");
	
	
	setLayout(new BorderLayout(0, 0));


	add(new JScrollPane(table), BorderLayout.CENTER);
	add(panel, BorderLayout.NORTH);
	panel.add(chckbxAutorefresh);
	panel.add(btnRefresh);
	panel.add(cboChooseLevel);
	
	datesorter = new TableRowSorter<>(table.getModel());
	List<RowSorter.SortKey> sortKeys = new ArrayList<>();
	int columnIndexToSort = 1;
	sortKeys.add(new RowSorter.SortKey(columnIndexToSort, SortOrder.DESCENDING));
	datesorter.setSortKeys(sortKeys);
	table.setRowSorter(datesorter);
	
	
	
	btnRefresh.addActionListener(ae -> model.fireTableDataChanged());
	
	chckbxAutorefresh.addItemListener(ie -> {

		if (chckbxAutorefresh.isSelected()) {
			t.start();
			btnRefresh.setEnabled(false);
		} else {
			t.stop();
			btnRefresh.setEnabled(true);
		}
	});
	
	cboChooseLevel.addActionListener(ae->{
		
		if(cboChooseLevel.getSelectedItem()!=null)
		{
			TableRowSorter<LogTableModel> sorter = new TableRowSorter<>(model);
			sorter.setRowFilter(RowFilter.regexFilter(cboChooseLevel.getSelectedItem().toString()));
			table.setRowSorter(sorter);
		}
		else
		{
			table.setRowSorter(datesorter);
			
		}
		
		
		
	});
	
	table.packAll();
}
 
Example 19
Source File: DrillDownParameterTable.java    From pentaho-reporting with GNU Lesser General Public License v2.1 4 votes vote down vote up
public DrillDownParameterTable() {
  setLayout( new BorderLayout() );

  listeners = new ArrayList<DrillDownParameterRefreshListener>();
  refreshParameterAction = new RefreshParameterAction();
  addParameterAction = new AddParameterAction();
  advancedEditorAction = new ShowAdvancedEditorAction();

  parameterTableModel = new DrillDownParameterTableModel();
  parameterTableModel.addTableModelListener( new DrillDownParameterChangeHandler() );

  allInOneTable = new ElementMetaDataTable();
  allInOneTable.setFormulaFragment( true );
  allInOneTable.setDefaultEditor( GroupedName.class, new GroupedNameCellEditor() );
  allInOneTable.setDefaultRenderer( String.class, new FormulaFragmentCellRenderer() );
  allInOneTable.setModel( new GroupedMetaTableModel( parameterTableModel ) );

  allInOneRemoveAction = new RemoveParameterAction( allInOneTable );

  systemParameterTable = new ElementMetaDataTable();
  systemParameterTable.setFormulaFragment( true );
  systemParameterTable.setDefaultEditor( GroupedName.class, new GroupedNameCellEditor() );
  systemParameterTable.setDefaultRenderer( String.class, new FormulaFragmentCellRenderer() );
  systemParameterTable.setModel(
      new FilteringParameterTableModel( DrillDownParameter.Type.SYSTEM, parameterTableModel, true ) );

  manualParameterTable = new ElementMetaDataTable();
  manualParameterTable.setFormulaFragment( true );
  manualParameterTable.setDefaultEditor( GroupedName.class, new GroupedNameCellEditor() );
  manualParameterTable.setDefaultRenderer( String.class, new FormulaFragmentCellRenderer() );
  manualParameterTable.setModel(
      new FilteringParameterTableModel( DrillDownParameter.Type.MANUAL, parameterTableModel ) );
  manualParameterRemoveAction = new RemoveParameterAction( manualParameterTable );

  predefinedParameterTable = new ElementMetaDataTable();
  predefinedParameterTable.setFormulaFragment( true );
  predefinedParameterTable.setDefaultEditor( GroupedName.class, new GroupedNameCellEditor() );
  predefinedParameterTable.setDefaultRenderer( String.class, new FormulaFragmentCellRenderer() );
  predefinedParameterTable.setModel(
      new FilteringParameterTableModel( DrillDownParameter.Type.PREDEFINED, parameterTableModel ) );

  hideParameterUiCheckbox = new JCheckBox( Messages.getString( "DrillDownParameterTable.HideParameterUI" ) );
  hideParameterUiCheckbox.addItemListener( new HideParamUiSelectionListener() );

  title = new JLabel( Messages.getString( "DrillDownParameterTable.Title" ) );

  rebuildUi();
}
 
Example 20
Source File: OnePageWindow.java    From wpcleaner with Apache License 2.0 2 votes vote down vote up
/**
 * Create a Automatic Comment checkbox.
 *
 * @param checked True if the checkbox should be checked.
 * @param listener Action listener.
 * @return Automatic Comment checkbox.
 */
public JCheckBox createChkAutomaticComment(boolean checked, ItemListener listener) {
  JCheckBox checkbox = Utilities.createJCheckBox(GT._T("Automatic comment"), checked);
  checkbox.addItemListener(listener);
  return checkbox;
}