Java Code Examples for javax.swing.JLabel#setMaximumSize()

The following examples show how to use javax.swing.JLabel#setMaximumSize() . 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: AbstractAdapterEditor.java    From snap-desktop with GNU General Public License v3.0 6 votes vote down vote up
JComponent addTextField(JPanel parent, TextFieldEditor textEditor, String labelText,
                        String propertyName, boolean isRequired, String[] excludedChars) {
    JLabel jLabel = new JLabel(labelText);
    Dimension size = jLabel.getPreferredSize();
    parent.add(jLabel);
    PropertyDescriptor propertyDescriptor = propertyContainer.getDescriptor(propertyName);
    if (isRequired) {
        propertyDescriptor.setValidator(new DecoratedNotEmptyValidator(jLabel, excludedChars));
        jLabel.setMaximumSize(new Dimension(size.width + 20, size.height));
    }
    JComponent editorComponent = textEditor.createEditorComponent(propertyDescriptor, bindingContext);
    UIUtils.addPromptSupport(editorComponent, "enter " + labelText.toLowerCase().replace(":", "") + " here");
    UIUtils.enableUndoRedo(editorComponent);
    editorComponent.setPreferredSize(new Dimension(editorComponent.getPreferredSize().width, controlHeight));
    editorComponent.setMaximumSize(new Dimension(editorComponent.getMaximumSize().width, controlHeight));
    jLabel.setLabelFor(editorComponent);
    parent.add(editorComponent);
    return editorComponent;
}
 
Example 2
Source File: ViewElementSlider.java    From Robot-Overlord-App with GNU General Public License v2.0 6 votes vote down vote up
public ViewElementSlider(RobotOverlord ro,IntEntity e,int top,int bottom) {
	super(ro);
	this.e=e;

	e.addObserver(this);
	
	field = new JSlider();
	field.setMaximum(top);
	field.setMinimum(bottom);
	field.setMinorTickSpacing(1);
	field.setValue(e.get());
	field.addChangeListener(this);
	field.addFocusListener(this);

	JLabel label = new JLabel(e.getName(),JLabel.LEADING);
	value = new JLabel(Integer.toString(field.getValue()),JLabel.RIGHT);
	Dimension dim = new Dimension(30,1);
	value.setMinimumSize(dim);
	value.setPreferredSize(dim);
	value.setMaximumSize(dim);
	
	panel.setLayout(new BorderLayout());
	panel.add(label,BorderLayout.LINE_START);
	panel.add(field,BorderLayout.CENTER);
	panel.add(value,BorderLayout.LINE_END);
}
 
Example 3
Source File: ViewElementSliderDouble.java    From Robot-Overlord-App with GNU General Public License v2.0 6 votes vote down vote up
public ViewElementSliderDouble(RobotOverlord ro,DoubleEntity e,int top,int bottom) {
	super(ro);
	this.e=e;

	e.addObserver(this);
	
	field = new JSlider();
	field.setMaximum(top);
	field.setMinimum(bottom);
	field.setMinorTickSpacing(1);
	field.setValue((int)Math.floor(e.get()));
	field.addChangeListener(this);
	field.addFocusListener(this);

	JLabel label = new JLabel(e.getName(),JLabel.LEADING);
	value = new JLabel(Integer.toString(field.getValue()),JLabel.RIGHT);
	Dimension dim = new Dimension(30,1);
	value.setMinimumSize(dim);
	value.setPreferredSize(dim);
	value.setMaximumSize(dim);
	
	panel.setLayout(new BorderLayout());
	panel.add(label,BorderLayout.LINE_START);
	panel.add(field,BorderLayout.CENTER);
	panel.add(value,BorderLayout.LINE_END);
}
 
Example 4
Source File: JSimpleColorPicker.java    From jeveassets with GNU General Public License v2.0 6 votes vote down vote up
private void add(JPanel jPanel, Color color) {
	if (color == null) {
		JLabel jLabel = new JLabel();
		Dimension dimension = new Dimension(ColorIcon.SIZE, ColorIcon.SIZE);
		jLabel.setMinimumSize(dimension);
		jLabel.setPreferredSize(dimension);
		jLabel.setMaximumSize(dimension);
		jPanel.add(jLabel);
		return;
	}
	ColorIcon icon = new ColorIcon(color);
	icons.add(icon);

	JButton jButton = createButton(icon);
	jButton.addActionListener(new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent e) {
			save(color);
		}
	});
	jPanel.add(jButton);
}
 
Example 5
Source File: MeasurementSetPanel.java    From opensim-gui with Apache License 2.0 5 votes vote down vote up
public static JPanel getTitleLabel() {
   JPanel titlePanel = new JPanel();
   titlePanel.setLayout(new BoxLayout(titlePanel, BoxLayout.X_AXIS));

   titlePanel.add(Box.createRigidArea(new Dimension(1,HEIGHT)));

   JLabel measurementsLabel = new JLabel("Measurements");
   measurementsLabel.setHorizontalAlignment(SwingConstants.CENTER);
   measurementsLabel.setBorder(measurementControlsBorder);
   Dimension dim = new Dimension(BUTTON_WIDTH+MEASUREMENT_NAME_WIDTH+2,HEIGHT);
   measurementsLabel.setMinimumSize(dim);
   measurementsLabel.setMaximumSize(dim);
   measurementsLabel.setPreferredSize(dim);
   titlePanel.add(measurementsLabel);

   JLabel markerPairsLabel = new JLabel("Marker Pairs");
   markerPairsLabel.setHorizontalAlignment(SwingConstants.CENTER);
   markerPairsLabel.setBorder(markerPairControlsBorder);
   markerPairsLabel.setMinimumSize(new Dimension(0,HEIGHT));
   markerPairsLabel.setMaximumSize(new Dimension(9999,HEIGHT));
   markerPairsLabel.setPreferredSize(dim);
   titlePanel.add(markerPairsLabel);

   titlePanel.add(Box.createRigidArea(new Dimension(1,HEIGHT)));

   return titlePanel;
}
 
Example 6
Source File: PlayerCounterPanel.java    From magarena with GNU General Public License v3.0 5 votes vote down vote up
private JLabel getIconLabel(String tooltip) {
    JLabel lbl = new JLabel();
    lbl.setToolTipText(tooltip);
    lbl.setHorizontalAlignment(SwingConstants.CENTER);
    lbl.setMinimumSize(new Dimension(16, 16));
    lbl.setPreferredSize(lbl.getMinimumSize());
    lbl.setMaximumSize(lbl.getMinimumSize());
    return lbl;
}
 
Example 7
Source File: GlobalSearchCategoryPanel.java    From rapidminer-studio with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Init the GUI.
 *
 * @param provider
 * 		the provider instance, must not be {@code null}
 */
private void initGUI(final GlobalSearchableGUIProvider provider) {
	setLayout(new GridBagLayout());
	GridBagConstraints gbc = new GridBagConstraints();
	setOpaque(false);
	setBorder(TOP_BORDER);

	JLabel i18nName = new JLabel();
	i18nName.setBackground(Colors.WINDOW_BACKGROUND);
	i18nName.setForeground(Color.GRAY);
	i18nName.setOpaque(true);
	i18nName.setVerticalAlignment(SwingConstants.TOP);
	i18nName.setHorizontalAlignment(SwingConstants.LEFT);
	i18nName.setFont(i18nName.getFont().deriveFont(Font.BOLD));
	i18nName.setText(provider.getI18nNameForSearchable());
	i18nName.setMinimumSize(I18N_NAME_SIZE);
	i18nName.setPreferredSize(I18N_NAME_SIZE);
	i18nName.setMaximumSize(I18N_NAME_SIZE);
	i18nName.setBorder(CATEGORY_LABEL_EMPTY_BORDER);

	gbc.gridx = 0;
	gbc.gridy = 0;
	gbc.weighty = 1.0d;
	gbc.fill = GridBagConstraints.VERTICAL;
	add(i18nName, gbc);

	contentPanel = new JPanel();
	contentPanel.setLayout(new GridBagLayout());
	contentPanel.setBorder(DIVIDER_BORDER);
	contentPanel.setBackground(Colors.WHITE);

	gbc.gridx = 1;
	gbc.weightx = 1.0d;
	gbc.weighty = 1.0d;
	gbc.fill = GridBagConstraints.BOTH;
	add(contentPanel, gbc);
}
 
Example 8
Source File: ItemDetailPanel.java    From osrsclient with GNU General Public License v2.0 5 votes vote down vote up
private void setup() {
    setLayout(new MigLayout("ins 0,align center, "));
    setBackground(new Color(51, 51, 51));
    setBorder(BorderFactory.createEtchedBorder(EtchedBorder.RAISED));

    wtbButton = new JToggleButton("WTB");
    wtsButton = new JToggleButton("WTS");
    wtbButton.setSelected(true);
    wtsButton.setSelected(true);
    itemSelectedLabel = new JLabel();
    itemSelectedLabel.setMaximumSize(new Dimension(160, 50));

    offerModel = new OfferModel();
    offerTable = new JTable(offerModel);

    //Setting up ideal column widths
    offerTable.getColumnModel().getColumn(0).setPreferredWidth(17);
    offerTable.getColumnModel().getColumn(1).setPreferredWidth(50);
    offerTable.getColumnModel().getColumn(3).setPreferredWidth(110);

    listScroller = new JScrollPane(offerTable, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);

    add(wtbButton, "cell 0 2,gapy 0");
    add(wtsButton, "cell 1 2, align right, spanx");
    add(new JLabel("Item:"), "cell 0 5, gapy 0, align left ");
    add(itemSelectedLabel, "cell 1 5, gapy 0, align left");
    add(listScroller, "cell 0 4,width 100%,height 100%,spanx");

}
 
Example 9
Source File: JarTool.java    From osp with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Constructor ProgressDialog
 * @param _owner
 * @param _steps
 * @param _title
 * @param _size
 */
public ProgressDialog(Frame _owner, int _steps, String _title, Dimension _size) {
  super(_owner);
  totalSteps = _steps;
  setTitle(_title);
  setSize(_size);
  setModal(false);
  getContentPane().setLayout(new java.awt.BorderLayout());
  JPanel progressPanel = new JPanel() {
    public Insets getInsets() {
      return new Insets(15, 10, 5, 10);
    }

  };
  progressPanel.setLayout(new BoxLayout(progressPanel, BoxLayout.Y_AXIS));
  getContentPane().add(progressPanel, BorderLayout.CENTER);
  Dimension d = new Dimension(_size.width, 20);
  progressLabel = new JLabel(_title);
  progressLabel.setAlignmentX(CENTER_ALIGNMENT);
  progressLabel.setMaximumSize(d);
  progressLabel.setPreferredSize(d);
  progressPanel.add(progressLabel);
  progressPanel.add(Box.createRigidArea(new Dimension(1, 20)));
  progressBar = new JProgressBar(0, totalSteps);
  progressBar.setStringPainted(true);
  progressLabel.setLabelFor(progressBar);
  progressBar.setAlignmentX(CENTER_ALIGNMENT);
  progressPanel.add(progressBar);
  Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
  setLocation((screenSize.width-_size.width)/2, (screenSize.height-_size.width)/2);
  getContentPane().add(progressPanel, BorderLayout.CENTER);
  setCursor(new Cursor(Cursor.WAIT_CURSOR));
  setVisible(true);
}
 
Example 10
Source File: FormUtils.java    From jdal with Apache License 2.0 5 votes vote down vote up
/**
 * @param message
 * @return JLabel
 */
public static JLabel newLabelForBox(String message) {
	JLabel label = new JLabel(message);
	label.setMaximumSize(new Dimension(Short.MAX_VALUE, label.getFont().getSize() + 10));
	label.setAlignmentX(Container.CENTER_ALIGNMENT);
	return label;
}
 
Example 11
Source File: StatusPanel.java    From jeveassets with GNU General Public License v2.0 5 votes vote down vote up
public static JLabel createIcon(final Icon icon, final String toolTip) {
	JLabel jLabel = new JLabel();
	jLabel.setIcon(icon);
	jLabel.setForeground(jLabel.getBackground().darker().darker().darker());
	jLabel.setMinimumSize(new Dimension(25, 25));
	jLabel.setPreferredSize(new Dimension(25, 25));
	jLabel.setMaximumSize(new Dimension(25, 25));
	jLabel.setHorizontalAlignment(JLabel.CENTER);
	jLabel.setToolTipText(toolTip);
	return jLabel;
}
 
Example 12
Source File: StatusPanel.java    From jeveassets with GNU General Public License v2.0 5 votes vote down vote up
private void addSpace(final int width) {
	JLabel jSpace = new JLabel();
	jSpace.setMinimumSize(new Dimension(width, 25));
	jSpace.setPreferredSize(new Dimension(width, 25));
	jSpace.setMaximumSize(new Dimension(width, 25));
	jToolBar.add(jSpace);
}
 
Example 13
Source File: GUIOption.java    From PacketProxy with Apache License 2.0 5 votes vote down vote up
private JComponent createDescription(String description) throws Exception {
	JLabel label = new JLabel(description);
	label.setForeground(Color.BLACK);
	label.setBackground(Color.WHITE);
	label.setMaximumSize(new Dimension(Short.MAX_VALUE, label.getMinimumSize().height));
	label.setAlignmentX(Component.LEFT_ALIGNMENT);
	return label;
}
 
Example 14
Source File: GUIOption.java    From PacketProxy with Apache License 2.0 5 votes vote down vote up
private JComponent createTitle(String title) throws Exception {
	JLabel label = new JLabel(title);
	label.setForeground(Color.decode("61136"));
	label.setBackground(Color.WHITE);
	label.setFont(FontManager.getInstance().getUICaptionFont());
	label.setMaximumSize(new Dimension(Short.MAX_VALUE, label.getMinimumSize().height));
	label.setAlignmentX(Component.LEFT_ALIGNMENT);
	return label;
}
 
Example 15
Source File: TransitionDialog.java    From SikuliX1 with MIT License 4 votes vote down vote up
void init(String text){

      setBackground(Color.yellow);
      setForeground(Color.black);

      JPanel content = new JPanel();
      content.setLayout(new BoxLayout(content, BoxLayout.Y_AXIS));
      add(content);

      textPane = new TextPane();
      textPane.setText(text);
      textPane.setBorder(BorderFactory.createEmptyBorder(3, 5, 3, 5));

      Color darkyellow = new Color(238,185,57);

      titleBar = new JLabel();
      titleBar.setFont(new Font("sansserif", Font.BOLD, 14));
      titleBar.setBackground(darkyellow);
      titleBar.setOpaque(true);
      titleBar.setBorder(BorderFactory.createEmptyBorder(5, 5, 3, 5));
      titleBar.setSize(titleBar.getPreferredSize());
      titleBar.setVisible(false);

      buttons = new Box(BoxLayout.X_AXIS);
      defaultButton = new Button("Close");
      buttons.add(defaultButton);
      buttons.setBorder(BorderFactory.createEmptyBorder(15,5,5,5));

      content.add(titleBar);
      content.add(textPane);
      content.add(buttons);

      // this allows the title bar to take the whole width of the dialog box
      titleBar.setMaximumSize(new Dimension(Integer.MAX_VALUE,Integer.MAX_VALUE));
      buttons.setMaximumSize(new Dimension(Integer.MAX_VALUE,Integer.MAX_VALUE));
      textPane.setMaximumSize(new Dimension(Integer.MAX_VALUE,Integer.MAX_VALUE));

      // these allow all the parts to left aligned
      titleBar.setAlignmentX(Component.LEFT_ALIGNMENT);
      textPane.setAlignmentX(Component.LEFT_ALIGNMENT);
      buttons.setAlignmentX(Component.LEFT_ALIGNMENT);

      // these are meant to prevent the message box from stealing
      // focus when it's clicked, but they don't seem to work
//      setFocusableWindowState(false);
//      setFocusable(false);

      // this allows the window to be dragged to another location on the screen
      ComponentMover cm = new ComponentMover();
      cm.registerComponent(this);

      pack();
   }
 
Example 16
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 17
Source File: ItemResultPanel.java    From osrsclient with GNU General Public License v2.0 4 votes vote down vote up
public void setup() {
    setLayout(new MigLayout("ins 0"));
    setBackground(Color.darkGray);

    setBorder(BorderFactory.createEtchedBorder(EtchedBorder.RAISED));

    itemNameLabel = new JLabel("--");

    //this prevents several item names from stretching too large
    itemNameLabel.setMaximumSize(new Dimension(160, 50));

    itemPriceLabel = new JLabel("--");

    itemPictureLabel = new JLabel(emptyItem);
    itemPictureLabel.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.RAISED));

    itemNameLabel.setForeground(Color.white);
    itemPriceLabel.setForeground(Color.white);

    addMouseListener(this);

    add(itemPictureLabel, "cell 0 0, width 20, height 20, dock west,");
    add(itemNameLabel, "cell 1 0");
    add(itemPriceLabel, "cell 1 1");
}
 
Example 18
Source File: ContactItem.java    From Spark with Apache License 2.0 4 votes vote down vote up
/**
   * Creates a new instance of a contact.
   *
   * @param alias             the alias of the contact
   * @param nickname          the nickname of the contact.
   * @param jid               the fully-qualified jid of the contact (ex. [email protected])
   */
  public ContactItem(String alias, String nickname, BareJid jid, boolean initUi) {
      setLayout(new GridBagLayout());

      // Set Default Font
      final LocalPreferences pref = SettingsManager.getLocalPreferences();
      fontSize = pref.getContactListFontSize();
      iconSize = pref.getContactListIconSize();
      avatarsShowing = pref.areAvatarsVisible();

      // Set default presence
      presence = new Presence(Presence.Type.unavailable);

      contactsDir = new File(SparkManager.getUserDirectory(), "contacts");

      this.alias = alias;
      this.nickname = nickname;
      this.jid = jid;

      if (initUi) {
displayNameLabel = new JLabel();
descriptionLabel = new JLabel();
imageLabel = new JLabel();
specialImageLabel = new JLabel();
sideIcon = new JLabel();
if (avatarsShowing) {
	sideIcon.setMinimumSize(new Dimension(iconSize, iconSize));
	sideIcon.setMaximumSize(new Dimension(iconSize, iconSize));
	sideIcon.setPreferredSize(new Dimension(iconSize, iconSize));
}

displayNameLabel.setHorizontalTextPosition(JLabel.LEFT);
displayNameLabel.setHorizontalAlignment(JLabel.LEFT);
//displayNameLabel.setText(nickname);


descriptionLabel.setFont(new Font("Dialog", Font.PLAIN, fontSize));
descriptionLabel.setForeground((Color)UIManager.get("ContactItemDescription.foreground"));
descriptionLabel.setHorizontalTextPosition(JLabel.LEFT);
descriptionLabel.setHorizontalAlignment(JLabel.LEFT);


this.setOpaque(true);

add(imageLabel, new GridBagConstraints(0, 0, 1, 2, 0.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 15, 0, 0), 0, 0));
add(displayNameLabel, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 5, 0, 0), 0, 0));
add(descriptionLabel, new GridBagConstraints(2, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 5, 2, 0), 0, 0));
add(specialImageLabel, new GridBagConstraints(3, 0, 1, 2, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 5, 0, 0), 0, 0));
add(sideIcon, new GridBagConstraints(4, 0, 1, 2, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 5, 0, 0), 0, 0));

setDisplayName();
      }
  }
 
Example 19
Source File: FilterPanel.java    From FoxTelem with GNU General Public License v3.0 4 votes vote down vote up
public void initializeGui() {

		setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
		ButtonGroup group = new ButtonGroup();
		filterRadioButtons = new JRadioButton[MAX_FILTERS];

		for (int i=0; i< MAX_FILTERS; i++) {
			filterRadioButtons[i] = addRadioButton(filterName[i]);
			group.add(filterRadioButtons[i]);
		}
	
		JLabel filler0 = new JLabel("");
		filler0.setMinimumSize(new Dimension(14,14));
		filler0.setMaximumSize(new Dimension(14,14));
		add(filler0);
		lFreq = new JLabel(L_FREQ);
		lFreq.setAlignmentX(Component.LEFT_ALIGNMENT);
		add(lFreq);
		
		freqSlider = createSlider(FREQ_MIN, FREQ_MAX, (int)Config.filterFrequency);
		freqSlider.setMinorTickSpacing(FREQ_STEP);
		
		add(freqSlider);
		
		//JPanel panel1 = new JPanel();
		//add(panel1);
		JLabel filler1 = new JLabel("");
		filler1.setMinimumSize(new Dimension(14,14));
		filler1.setMaximumSize(new Dimension(14,14));
		add(filler1);
		lLength = new JLabel(L_LENGTH);
		lLength.setAlignmentX(Component.LEFT_ALIGNMENT);
		add(lLength);
		
		rcSlider = createSlider(RC_LEN_MIN, RC_LEN_MAX, RC_LEN_MIN);
		wsSlider = createSlider(WS_LEN_MIN, WS_LEN_MAX, WS_LEN_MIN*2);
		//updateSlider();
		add(rcSlider);
		add(wsSlider);
		
		JLabel filler2 = new JLabel("");
		filler2.setMinimumSize(new Dimension(14,44));
		filler2.setMaximumSize(new Dimension(14,44));
		add(filler2);
		/*
		JPanel panel1 = new JPanel();
		add(panel1);
//		panel1.setLayout(new BoxLayout(panel1, BoxLayout.X_AXIS));
		panel1.setLayout(new FlowLayout());
		JLabel lfreq = new JLabel("Cuttoff Freq");
		panel1.add(lfreq);
		JTextField txtFreq = new JTextField();
		panel1.add(txtFreq);
		JPanel panel2 = new JPanel();
		add(panel2);
		//panel2.setLayout(new BoxLayout(panel2, BoxLayout.X_AXIS));
		panel2.setLayout(new FlowLayout());
		JLabel lLength = new JLabel("Length (bits)");
		panel2.add(lLength);
		JTextField txtLength = new JTextField();
		panel2.add(txtLength);
		*/
		
		setFilter();
	}
 
Example 20
Source File: ReprocessedTab.java    From jeveassets with GNU General Public License v2.0 4 votes vote down vote up
public ReprocessedTab(final Program program) {
	super(program, TabsReprocessed.get().title(), Images.TOOL_REPROCESSED.getIcon(), true);

	JFixedToolBar jToolBarLeft = new JFixedToolBar();

	JButton jClear = new JButton(TabsReprocessed.get().removeAll(), Images.EDIT_DELETE.getIcon());
	jClear.setActionCommand(ReprocessedAction.CLEAR.name());
	jClear.addActionListener(listener);
	jToolBarLeft.addButton(jClear);

	jToolBarLeft.addSpace(30);

	JLabel jInfo = new JLabel(TabsReprocessed.get().info());
	jInfo.setMinimumSize(new Dimension(100, Program.getButtonsHeight()));
	jInfo.setMaximumSize(new Dimension(Short.MAX_VALUE, Program.getButtonsHeight()));
	jInfo.setHorizontalAlignment(SwingConstants.LEFT);
	jToolBarLeft.add(jInfo);

	JFixedToolBar jToolBarRight = new JFixedToolBar();

	JButton jCollapse = new JButton(TabsReprocessed.get().collapse(), Images.MISC_COLLAPSED.getIcon());
	jCollapse.setActionCommand(ReprocessedAction.COLLAPSE.name());
	jCollapse.addActionListener(listener);
	jToolBarRight.addButton(jCollapse);

	JButton jExpand = new JButton(TabsReprocessed.get().expand(), Images.MISC_EXPANDED.getIcon());
	jExpand.setActionCommand(ReprocessedAction.EXPAND.name());
	jExpand.addActionListener(listener);
	jToolBarRight.addButton(jExpand);

	//Table Format
	tableFormat = new EnumTableFormatAdaptor<>(ReprocessedTableFormat.class);
	//Backend
	eventList = EventListManager.create();
	//Sorting (per column)
	eventList.getReadWriteLock().readLock().lock();
	SortedList<ReprocessedInterface> sortedListColumn = new SortedList<>(eventList);
	eventList.getReadWriteLock().readLock().unlock();

	//Sorting Total (Ensure that total is always last)
	eventList.getReadWriteLock().readLock().lock();
	SortedList<ReprocessedInterface> sortedListTotal = new SortedList<>(sortedListColumn, new TotalComparator());
	eventList.getReadWriteLock().readLock().unlock();
	//Filter
	eventList.getReadWriteLock().readLock().lock();
	filterList = new FilterList<>(sortedListTotal);
	eventList.getReadWriteLock().readLock().unlock();
	//Separator
	separatorList = new SeparatorList<>(filterList, new ReprocessedSeparatorComparator(), 1, Integer.MAX_VALUE);
	//Table Model
	tableModel = EventModels.createTableModel(separatorList, tableFormat);
	//Table
	jTable = new JReprocessedTable(program, tableModel, separatorList);
	jTable.setSeparatorRenderer(new ReprocessedSeparatorTableCell(jTable, separatorList, listener));
	jTable.setSeparatorEditor(new ReprocessedSeparatorTableCell(jTable, separatorList, listener));
	jTable.setCellSelectionEnabled(true);
	PaddingTableCellRenderer.install(jTable, 3);
	//Sorting
	TableComparatorChooser.install(jTable, sortedListColumn, TableComparatorChooser.MULTIPLE_COLUMN_MOUSE, tableFormat);
	//Selection Model
	selectionModel = EventModels.createSelectionModel(separatorList);
	selectionModel.setSelectionMode(ListSelection.MULTIPLE_INTERVAL_SELECTION_DEFENSIVE);
	jTable.setSelectionModel(selectionModel);
	//Listeners
	installTable(jTable, NAME);
	//Scroll
	JScrollPane jTableScroll = new JScrollPane(jTable);
	//Table Filter
	filterControl = new ReprocessedFilterControl(
			tableFormat,
			program.getMainWindow().getFrame(),
			eventList,
			sortedListTotal,
			filterList,
			Settings.get().getTableFilters(NAME)
			);

	//Menu
	installMenu(program, new ReprocessedTableMenu(), jTable, ReprocessedInterface.class);

	layout.setHorizontalGroup(
		layout.createParallelGroup(GroupLayout.Alignment.TRAILING)
			.addComponent(filterControl.getPanel())
			.addGroup(layout.createSequentialGroup()
				.addComponent(jToolBarLeft, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, Integer.MAX_VALUE)
				.addGap(0)
				.addComponent(jToolBarRight)
			)
			.addComponent(jTableScroll, 0, 0, Short.MAX_VALUE)
	);
	layout.setVerticalGroup(
		layout.createSequentialGroup()
			.addComponent(filterControl.getPanel())
			.addGroup(layout.createParallelGroup()
				.addComponent(jToolBarLeft, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
				.addComponent(jToolBarRight, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
			)
			.addComponent(jTableScroll, 0, 0, Short.MAX_VALUE)
	);
}