Java Code Examples for javax.swing.JTextField#setMinimumSize()

The following examples show how to use javax.swing.JTextField#setMinimumSize() . 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: Search.java    From gcs with Mozilla Public License 2.0 6 votes vote down vote up
/**
 * Creates the search panel.
 *
 * @param target The search target.
 */
public Search(SearchTarget target) {
    mTarget = target;

    mFilterField = new JTextField(10);
    mFilterField.getDocument().addDocumentListener(this);
    mFilterField.addKeyListener(this);
    mFilterField.addFocusListener(this);
    mFilterField.setToolTipText(Text.wrapPlainTextForToolTip(I18n.Text("Enter text here and press RETURN to select all matching items")));
    // This client property is specific to Mac OS X
    mFilterField.putClientProperty("JTextField.variant", "search");
    mFilterField.setMinimumSize(new Dimension(60, mFilterField.getPreferredSize().height));
    add(mFilterField);

    mHits = new JLabel();
    mHits.setToolTipText(Text.wrapPlainTextForToolTip(I18n.Text("The number of matches found")));
    adjustHits();
    add(mHits);

    FlexRow row = new FlexRow();
    row.add(mFilterField);
    row.add(mHits);
    row.apply(this);
}
 
Example 2
Source File: SignalButton.java    From Ardulink-2 with Apache License 2.0 6 votes vote down vote up
/**
 * Create the panel.
 */
public SignalButton() {
	setLayout(new BorderLayout(0, 0));
	
	signalButton = new JButton("Send");
	signalButton.addActionListener(new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent e) {
			link.sendCustomMessage(getId(), getValue());
		}
	});
	add(signalButton);
	
	valuePanel = new JPanel();
	add(valuePanel, BorderLayout.NORTH);
	
	valueLabel = new JLabel("Value:");
	valuePanel.add(valueLabel);
	
	textField = new JTextField();
	valuePanel.add(textField);
	textField.setColumns(10);
	textField.setMinimumSize(getPreferredSize());

}
 
Example 3
Source File: OAuthDialog.java    From rapidminer-studio with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * Creates and returns the GUI components for step2.
 *
 * @return
 */
private Component createStep2Panel() {
	JPanel panel = new JPanel();
	panel.setLayout(new GridBagLayout());
	GridBagConstraints gbc = new GridBagConstraints();

	gbc.gridx = 0;
	gbc.gridy = 0;
	gbc.weightx = 1;
	gbc.fill = GridBagConstraints.BOTH;
	gbc.insets = new Insets(0, 51, 0, 0);

	codeText = new JTextField();
	codeText.setMinimumSize(new Dimension(80, 33));
	codeText.setPreferredSize(new Dimension(80, 33));
	panel.add(codeText, gbc);

	panel.setBorder(new RoundTitledBorder(2, I18N.getMessage(I18N.getGUIBundle(),
			"gui.dialog.oauth_dialog.copy_code.label"), false));
	return panel;
}
 
Example 4
Source File: SignalButton.java    From Ardulink-1 with Apache License 2.0 6 votes vote down vote up
/**
 * Create the panel.
 */
public SignalButton() {
	setLayout(new BorderLayout(0, 0));
	
	signalButton = new JButton("Send");
	signalButton.addActionListener(new ActionListener() {
		public void actionPerformed(ActionEvent e) {
			String message = customMessageMaker.getCustomMessage(getId(), getValue());;
			link.sendCustomMessage(message, replyMessageCallback);
		}
	});
	add(signalButton);
	
	valuePanel = new JPanel();
	add(valuePanel, BorderLayout.NORTH);
	
	valueLabel = new JLabel("Value:");
	valuePanel.add(valueLabel);
	
	textField = new JTextField();
	valuePanel.add(textField);
	textField.setColumns(10);
	textField.setMinimumSize(getPreferredSize());

}
 
Example 5
Source File: SelectDisplaySettingsWizardPanel.java    From nextreports-designer with Apache License 2.0 6 votes vote down vote up
private Component[] createColorField(String text, Color defaultColor) {
	JLabel colorLabel = new JLabel(text);
	final JTextField colorField = new JTextField();
	colorField.setEditable(false);
	colorField.setPreferredSize(txtDim);
	colorField.setMinimumSize(txtDim);
	colorField.setText(String.valueOf(defaultColor.getRGB()));	
	colorField.setBackground(defaultColor);
	JButton colorButton = new JButton();
	colorButton.setPreferredSize(buttonDim);
	colorButton.setMinimumSize(buttonDim);
	colorButton.setMaximumSize(buttonDim);
	colorButton.setIcon(ImageUtil.getImageIcon("copy_settings"));
	colorButton.addActionListener(new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent e) {
			Color color = ExtendedColorChooser.showDialog(SwingUtilities.getWindowAncestor(SelectDisplaySettingsWizardPanel.this), 
					I18NSupport.getString("color.dialog.title"), null);
			if (color != null) {
				colorField.setText(String.valueOf(color.getRGB()));	
				colorField.setBackground(color);
			}
		}			
	});		
	return new Component[] {colorLabel, colorField, colorButton};
}
 
Example 6
Source File: LibraryDockable.java    From gcs with Mozilla Public License 2.0 5 votes vote down vote up
private void createFilterField() {
    mFilterField = new JTextField(10);
    mFilterField.getDocument().addDocumentListener(this);
    mFilterField.setToolTipText(Text.wrapPlainTextForToolTip(I18n.Text("Enter text here to narrow the list to only those rows containing matching items")));
    // This client property is specific to Mac OS X
    mFilterField.putClientProperty("JTextField.variant", "search");
    mFilterField.setMinimumSize(new Dimension(60, mFilterField.getPreferredSize().height));
    mToolbar.add(mFilterField, Toolbar.LAYOUT_FILL);
}
 
Example 7
Source File: UpdateManagerDialog.java    From bigtable-sql with Apache License 2.0 5 votes vote down vote up
private JTextField getSizedTextField(Dimension preferredSize) {
   JTextField result = new JTextField();
   result.setPreferredSize(preferredSize);
   result.setMinimumSize(preferredSize);
   result.setEditable(false);
   return result;
}
 
Example 8
Source File: MeasurementSetPanel.java    From opensim-gui with Apache License 2.0 5 votes vote down vote up
public JComponent getMarkerComponent(final String name, final int measurementIndex, final int markerPairIndex, final int index) {
   Dimension dim = new Dimension(MARKER_NAME_WIDTH,HEIGHT);
   JTextField markerButton = new JTextField(name);
   markerButton.setEditable(false);
   markerButton.setHorizontalAlignment(SwingConstants.CENTER);
   // Indicate marker does not exist in model's marker set with red color (though the measurement may still be invalid
   // if this marker is not found in the marker data passed to the model scaler)
   boolean markerInModel = measurementSetModel.getMarkerExistsInModel(name);
   boolean markerInMeasurementTrial = measurementSetModel.getMarkerExistsInMeasurementTrial(name);
   if(!markerInModel || !markerInMeasurementTrial) {
      markerButton.setBackground(invalidColor);
      if(!markerInModel && !markerInMeasurementTrial) markerButton.setToolTipText("Marker not in model or measurement marker data!");
      else if(!markerInModel) markerButton.setToolTipText("Marker not in model!");
      else markerButton.setToolTipText("Marker not in measurement marker data!");
   } else {
      markerButton.setBackground(Color.white);
      markerButton.setToolTipText(null);
   }
   markerButton.setMinimumSize(dim);
   markerButton.setMaximumSize(dim);
   markerButton.setPreferredSize(dim);
   markerButton.setBorder(markerInnerBorder);
   markerButton.addMouseListener(new MouseAdapter() {
      public void mousePressed(MouseEvent evt) {
         JPopupMenu popup = new JPopupMenu();
         for(int i=0; i<markerNames.size(); i++) {
            JRadioButtonMenuItem item = new JRadioButtonMenuItem(new ChangeMarkerPairMarkerAction(markerNames.get(i), measurementIndex, markerPairIndex, index));
            if(markerNames.get(i).equals(name)) item.setSelected(true);
            popup.add(item);
         }
         popup.setLayout(new GridLayout(25,markerNames.size()/25+1));
         popup.show(evt.getComponent(),evt.getX(),evt.getY());
      }
   });

   return markerButton;
}
 
Example 9
Source File: DataViewUI.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private void initToolbarWest(JToolBar toolbar, ActionListener outputListener, boolean nbOutputComponent) {

        if (!nbOutputComponent) {
            JButton[] btns = getEditButtons();
            for (JButton btn : btns) {
                if (btn != null) {
                    toolbar.add(btn);
                }
            }
        }

        toolbar.addSeparator(new Dimension(10, 10));

        //add refresh button
        URL url = getClass().getResource(IMG_PREFIX + "refresh.png"); // NOI18N
        refreshButton = new JButton(new ImageIcon(url));
        refreshButton.setToolTipText(NbBundle.getMessage(DataViewUI.class, "TOOLTIP_refresh"));
        refreshButton.addActionListener(outputListener);
        processButton(refreshButton);

        toolbar.add(refreshButton);

        //add limit row label
        limitRow = new JLabel(NbBundle.getMessage(DataViewUI.class, "LBL_max_rows"));
        limitRow.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 8));
        toolbar.add(limitRow);

        //add refresh text field
        refreshField = new JTextField(5);
        refreshField.setMinimumSize(refreshField.getPreferredSize());
        refreshField.setMaximumSize(refreshField.getPreferredSize());
        refreshField.addFocusListener(new FocusAdapter() {
            @Override
            public void focusGained(FocusEvent e) {
                refreshField.selectAll();
            }
        });
        refreshField.addActionListener(outputListener);
        toolbar.add(refreshField);
        toolbar.addSeparator(new Dimension(10, 10));

        JLabel fetchedRowsNameLabel = new JLabel(NbBundle.getMessage(DataViewUI.class, "LBL_fetched_rows"));
        fetchedRowsNameLabel.getAccessibleContext().setAccessibleName(NbBundle.getMessage(DataViewUI.class, "LBL_fetched_rows"));
        fetchedRowsNameLabel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));
        toolbar.add(fetchedRowsNameLabel);
        fetchedRowsLabel = new JLabel();
        toolbar.add(fetchedRowsLabel);

        toolbar.addSeparator(new Dimension(10, 10));
    }
 
Example 10
Source File: FcdProPlusPanel.java    From FoxTelem with GNU General Public License v3.0 4 votes vote down vote up
public void initializeGui() throws IOException, DeviceException {
	setLayout(new BorderLayout(3,3));
	JPanel center = new JPanel();
	JPanel top = new JPanel();
	add(top, BorderLayout.NORTH);
	top.setLayout(new BoxLayout(top, BoxLayout.X_AXIS));
	cbMixerGain = new JCheckBox("Mixer Gain");
	top.add(cbMixerGain);
	cbMixerGain.addItemListener(this);
	cbLnaGain = new JCheckBox("LNA Gain");
	top.add(cbLnaGain);
	cbLnaGain.addItemListener(this);
	top.add(new Box.Filler(new Dimension(10,10), new Dimension(10,10), new Dimension(10,10)));
	/*
	JLabel lblIfGain = new JLabel("IF Gain ");
	top.add(lblIfGain);
	String[] vals = new String[60];
	for (int i=0; i < 60; i++)
		vals[i] = ""+i;
	SpinnerListModel ifGainModel = new SpinnerListModel(vals);
	ifSpinner = new JSpinner(ifGainModel);
	JComponent editor = ifSpinner.getEditor();
    JFormattedTextField ftf = ((JSpinner.DefaultEditor)editor).getTextField();
	ftf.setColumns(3);
	ifSpinner.addChangeListener(this);
	top.add(ifSpinner);
	
	*/
	add(center, BorderLayout.CENTER);
	center.setLayout(new BoxLayout(center, BoxLayout.X_AXIS));
	
	JLabel rfFilter = new JLabel("    RF Filter");
	top.add(rfFilter);
	rfFilterValue = new JTextField();
	rfFilterValue.setColumns(35);
	rfFilterValue.setEnabled(false);
	rfFilterValue.setMinimumSize(new Dimension(70,10));
	top.add(rfFilterValue);
	
	JLabel ifFilter = new JLabel("    IF Filter");
	top.add(ifFilter);
	ifFilterValue = new JTextField();
	ifFilterValue.setColumns(30);
	ifFilterValue.setEnabled(false);
	ifFilterValue.setMinimumSize(new Dimension(40,10));
	top.add(ifFilterValue);
	
	top.add(new Box.Filler(new Dimension(10,10), new Dimension(10,10), new Dimension(10,10)));
	cbBiasTee = new JCheckBox("Bias T");
	top.add(cbBiasTee);
	cbBiasTee.addItemListener(this);
	
	top.add(new Box.Filler(new Dimension(10,10), new Dimension(500,10), new Dimension(1000,10)));
}
 
Example 11
Source File: FcdProPanel.java    From FoxTelem with GNU General Public License v3.0 4 votes vote down vote up
@SuppressWarnings({ "unchecked", "rawtypes" })
public void initializeGui() throws IOException, DeviceException {
	setLayout(new BorderLayout(3,3));
	JPanel center = new JPanel();
	add(center, BorderLayout.NORTH);
	center.setLayout(new BoxLayout(center, BoxLayout.X_AXIS));
	
	// LNA gain 10 default, -5 to +30 
	JLabel lblLna = new JLabel("LNA Gain");
	center.add(lblLna);
	cbLnaGain = new JComboBox(FCD1TunerController.lnaGain);
	center.add(cbLnaGain);
	cbLnaGain.addItemListener(this);
	
	// Mixer Gain 4dB or 12dB
	JLabel lblMix = new JLabel("    Mixer Gain");
	center.add(lblMix);
	cbMixerGain = new JComboBox(FCD1TunerController.mixerGain);
	
	center.add(cbMixerGain);
	cbMixerGain.addItemListener(this);
	
	// IF Gain 1 - -3dB or +6dB
	
	// Band
	JLabel lblband = new JLabel("    Band");
	center.add(lblband);
	bandValue = new JTextField();
	bandValue.setMinimumSize(new Dimension(40,10));
	bandValue.setEnabled(false);
	center.add(bandValue);
	
	// RF Filter - not needed 268Mhz vs 298Mhz
	JLabel rfFilter = new JLabel("    RF Filter");
	center.add(rfFilter);
	rfFilterValue = new JTextField();
	rfFilterValue.setMinimumSize(new Dimension(70,10));
	rfFilterValue.setEnabled(false);
	center.add(rfFilterValue);


}
 
Example 12
Source File: LogPanel.java    From nextreports-designer with Apache License 2.0 4 votes vote down vote up
public LogPanel() {
    if (tailer == null) {

        setPreferredSize(new Dimension(400, 300));
        setLayout(new BorderLayout());

        textArea = new JTextArea();
        textArea.setEditable(false);
        textArea.setLineWrap(true);
        textArea.setWrapStyleWord(true);
        JScrollPane scrollPanel = new JScrollPane(textArea);

        linesTextField = new JTextField();
        linesTextField.setPreferredSize(dim);
        linesTextField.setMinimumSize(dim);
        linesTextField.setMaximumSize(dim);
        linesTextField.setText(String.valueOf(LINES));

        JToolBar toolBar = new JToolBar();
        toolBar.setRollover(true);
        toolBar.add(new ClearLogAction(textArea));
        toolBar.add(new ReloadLogAction(textArea, this));

        JPanel topPanel = new JPanel();
        topPanel.setLayout(new BoxLayout(topPanel, BoxLayout.X_AXIS));
        topPanel.add(toolBar);
        topPanel.add(Box.createHorizontalStrut(5));
        topPanel.add(new JLabel(I18NSupport.getString("logpanel.last.lines")));
        topPanel.add(Box.createHorizontalStrut(5));
        topPanel.add(linesTextField);
        topPanel.add(Box.createHorizontalGlue());

        add(topPanel, BorderLayout.NORTH);
        add(scrollPanel, BorderLayout.CENTER);

        final File log = new File(LOG);
        if (!log.exists()) {
            try {
                new File(LOG_DIR).mkdirs();
                boolean created = log.createNewFile();
            } catch (IOException ex) {
                ex.printStackTrace();
            }
        }

        // read existing text in log
        Thread t = new Thread(new Runnable() {
            public void run() {
                Cursor hourGlassCursor = new Cursor(Cursor.WAIT_CURSOR);
                setCursor(hourGlassCursor);

                //@todo
                //reload(log, textArea);

                tailer = new LogFileTailer(log, 1000, false);
                tailer.addLogFileTailerListener(LogPanel.this);
                tailer.setPriority(Thread.MIN_PRIORITY);

                // very consuming !!!
                //tailer.start();

                Cursor normalCursor = new Cursor(Cursor.DEFAULT_CURSOR);
                setCursor(normalCursor);
            }
        }, "NEXT : " + getClass().getSimpleName());
        t.start();

    }
}
 
Example 13
Source File: SelectIndicatorSettingsWizardPanel.java    From nextreports-designer with Apache License 2.0 4 votes vote down vote up
private void init() {
	setLayout(new GridBagLayout());  
	
	JLabel titleLabel = new JLabel(I18NSupport.getString("wizard.panel.indicator.data.title"));
	titleField = new JTextField();
	titleField.setPreferredSize(txtDim);
	titleField.setMinimumSize(txtDim);
	
	JLabel descLabel = new JLabel(I18NSupport.getString("wizard.panel.indicator.data.description"));
	descField = new JTextField();
	descField.setPreferredSize(txtDim);
	descField.setMinimumSize(txtDim);
	
	JLabel unitLabel = new JLabel(I18NSupport.getString("wizard.panel.indicator.data.unit"));
	unitField = new JTextField();
	unitField.setPreferredSize(txtDim);
	unitField.setMinimumSize(txtDim);
	
	JLabel minLabel = new JLabel(I18NSupport.getString("wizard.panel.indicator.data.min"));
	minField = new JTextField();
	minField.setPreferredSize(txtDim);
	minField.setMinimumSize(txtDim);
	
	JLabel maxLabel = new JLabel(I18NSupport.getString("wizard.panel.indicator.data.max"));
	maxField = new JTextField();
	maxField.setPreferredSize(txtDim);
	maxField.setMinimumSize(txtDim);
	
	showMinMax = new JCheckBox(I18NSupport.getString("wizard.panel.indicator.data.show"));
	shadow = new JCheckBox(I18NSupport.getString("wizard.panel.display.shadow"));
	
	JLabel colorLabel = new JLabel(I18NSupport.getString("wizard.panel.indicator.data.color"));
	colorField = new JTextField();
	colorField.setEditable(false);
	colorField.setPreferredSize(txtDim);
	colorField.setMinimumSize(txtDim);
	JButton colorButton = new JButton();
	colorButton.setPreferredSize(buttonDim);
	colorButton.setMinimumSize(buttonDim);
	colorButton.setMaximumSize(buttonDim);
	colorButton.setIcon(ImageUtil.getImageIcon("copy_settings"));
	colorButton.addActionListener(new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent e) {
			Color color = ExtendedColorChooser.showDialog(SwingUtilities.getWindowAncestor(SelectIndicatorSettingsWizardPanel.this), 
					I18NSupport.getString("color.dialog.title"), null);
			if (color != null) {
				colorField.setText(String.valueOf(color.getRGB()));	
				colorField.setBackground(color);
			}
		}			
	});		
	
	JLabel imageLabel = new JLabel(ImageUtil.getImageIcon("indicator_main"));
	imageLabel.setPreferredSize(new Dimension(280, 170));
	
	add(titleLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0,  GridBagConstraints.WEST, 
			GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
	add(titleField, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0,  GridBagConstraints.WEST, 
			GridBagConstraints.NONE, new Insets(5, 0, 5, 5), 0, 0));
	add(imageLabel, new GridBagConstraints(3, 0, 1, 9, 1.0, 1.0,  GridBagConstraints.CENTER, 
			GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0));
	add(descLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0,  GridBagConstraints.WEST, 
			GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
	add(descField, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0,  GridBagConstraints.WEST, 
			GridBagConstraints.NONE, new Insets(5, 0, 5, 5), 0, 0));
	add(unitLabel, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0,  GridBagConstraints.WEST, 
			GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
	add(unitField, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0,  GridBagConstraints.WEST, 
			GridBagConstraints.NONE, new Insets(5, 0, 5, 5), 0, 0));
	add(minLabel, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0,  GridBagConstraints.WEST, 
			GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
	add(minField, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0,  GridBagConstraints.WEST, 
			GridBagConstraints.NONE, new Insets(5, 0, 5, 5), 0, 0));
	add(maxLabel, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0,  GridBagConstraints.WEST, 
			GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
	add(maxField, new GridBagConstraints(1, 4, 1, 1, 0.0, 0.0,  GridBagConstraints.WEST, 
			GridBagConstraints.NONE, new Insets(5, 0, 5, 5), 0, 0));
	add(showMinMax, new GridBagConstraints(0, 5, 2, 1, 0.0, 0.0,  GridBagConstraints.WEST, 
			GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
	add(shadow, new GridBagConstraints(0, 6, 2, 1, 0.0, 0.0,  GridBagConstraints.WEST, 
			GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));		
	add(colorLabel, new GridBagConstraints(0, 7, 1, 1, 0.0, 0.0,  GridBagConstraints.WEST, 
			GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
	add(colorField, new GridBagConstraints(1, 7, 1, 1, 0.0, 0.0,  GridBagConstraints.WEST, 
			GridBagConstraints.NONE, new Insets(5, 0, 5, 5), 0, 0));
	add(colorButton, new GridBagConstraints(2, 7, 1, 1, 0.0, 0.0,  GridBagConstraints.WEST, 
			GridBagConstraints.NONE, new Insets(5, 0, 5, 5), 0, 0));
}
 
Example 14
Source File: SelectDisplaySettingsWizardPanel.java    From nextreports-designer with Apache License 2.0 4 votes vote down vote up
private void init() {
	setLayout(new GridBagLayout());  
			
	JLabel titleLabel = new JLabel(I18NSupport.getString("wizard.panel.display.title"));
	titleField = new JTextField();
	titleField.setPreferredSize(txtDim);
	titleField.setMinimumSize(txtDim);				
	
	shouldRise = new JCheckBox(I18NSupport.getString("wizard.panel.display.shouldRise"));
	shadow = new JCheckBox(I18NSupport.getString("wizard.panel.display.shadow"));
	
	Component[] titleColor = createColorField(I18NSupport.getString("wizard.panel.display.title.color"), Color.BLACK);		
	titleColorField = (JTextField)titleColor[1];			
	
	Component[] valueColor = createColorField(I18NSupport.getString("wizard.panel.display.value.color"), Color.BLUE);		
	valueColorField = (JTextField)valueColor[1];	
	
	Component[] previousColor = createColorField(I18NSupport.getString("wizard.panel.display.previous.color"), Color.LIGHT_GRAY);		
	previousColorField = (JTextField)previousColor[1];		
	
	Component[] backgroundColor = createColorField(I18NSupport.getString("wizard.panel.display.background.color"), Color.WHITE);		
	backgroundColorField = (JTextField)backgroundColor[1];		
					
	JLabel imageLabel = new JLabel(ImageUtil.getImageIcon("display_main"));
	imageLabel.setPreferredSize(new Dimension(280, 170));
	
	add(titleLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0,  GridBagConstraints.WEST, 
			GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
	add(titleField, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0,  GridBagConstraints.WEST, 
			GridBagConstraints.NONE, new Insets(5, 0, 5, 5), 0, 0));
	add(imageLabel, new GridBagConstraints(3, 0, 1, 8, 1.0, 1.0,  GridBagConstraints.CENTER, 
			GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0));		
	add(shouldRise, new GridBagConstraints(0, 1, 2, 1, 0.0, 0.0,  GridBagConstraints.WEST, 
			GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
	add(shadow, new GridBagConstraints(0, 2, 2, 1, 0.0, 0.0,  GridBagConstraints.WEST, 
			GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
	add(titleColor[0], new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0,  GridBagConstraints.WEST, 
			GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
	add(titleColorField, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0,  GridBagConstraints.WEST, 
			GridBagConstraints.NONE, new Insets(5, 0, 5, 5), 0, 0));
	add(titleColor[2], new GridBagConstraints(2, 3, 1, 1, 0.0, 0.0,  GridBagConstraints.WEST, 
			GridBagConstraints.NONE, new Insets(5, 0, 5, 5), 0, 0));
	add(valueColor[0], new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0,  GridBagConstraints.WEST, 
			GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
	add(valueColorField, new GridBagConstraints(1, 4, 1, 1, 0.0, 0.0,  GridBagConstraints.WEST, 
			GridBagConstraints.NONE, new Insets(5, 0, 5, 5), 0, 0));
	add(valueColor[2], new GridBagConstraints(2, 4, 1, 1, 0.0, 0.0,  GridBagConstraints.WEST, 
			GridBagConstraints.NONE, new Insets(5, 0, 5, 5), 0, 0));
	add(previousColor[0], new GridBagConstraints(0, 5, 1, 1, 0.0, 0.0,  GridBagConstraints.WEST, 
			GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
	add(previousColorField, new GridBagConstraints(1, 5, 1, 1, 0.0, 0.0,  GridBagConstraints.WEST, 
			GridBagConstraints.NONE, new Insets(5, 0, 5, 5), 0, 0));
	add(previousColor[2], new GridBagConstraints(2, 5, 1, 1, 0.0, 0.0,  GridBagConstraints.WEST, 
			GridBagConstraints.NONE, new Insets(5, 0, 5, 5), 0, 0));
	add(backgroundColor[0], new GridBagConstraints(0, 6, 1, 1, 0.0, 0.0,  GridBagConstraints.WEST, 
			GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
	add(backgroundColorField, new GridBagConstraints(1, 6, 1, 1, 0.0, 0.0,  GridBagConstraints.WEST, 
			GridBagConstraints.NONE, new Insets(5, 0, 5, 5), 0, 0));
	add(backgroundColor[2], new GridBagConstraints(2, 6, 1, 1, 0.0, 0.0,  GridBagConstraints.WEST, 
			GridBagConstraints.NONE, new Insets(5, 0, 5, 5), 0, 0));
}
 
Example 15
Source File: KeySelectionPanel.java    From nextreports-designer with Apache License 2.0 4 votes vote down vote up
public KeySelectionPanel(boolean showValueField) {
    this.showValueField = showValueField;        
   
    keysCombo = new JComboBox();
    keysCombo.setEditable(true);
    AutoCompleteDecorator.decorate(keysCombo);
    keysCombo.setMinimumSize(dim);
    keysCombo.setPreferredSize(dim);
    if (showValueField) {
    	keysCombo.setEnabled(false);
    }
    
    List<String> keys = NextReportsUtil.getReportKeys();
    for (String key : keys) {
    	keysCombo.addItem(key);
    }        
    
    valueField = new JTextField();
    valueField.setMinimumSize(dim);
    valueField.setPreferredSize(dim);
    
    allCheck = new JCheckBox(I18NSupport.getString("languages.keys.selection.key.all"));

    setLayout(new GridBagLayout());
    
    add(new JLabel(I18NSupport.getString("languages.keys.selection.key")),
    		new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST,
            GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
    add(keysCombo,
    		new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0));
    
    if (showValueField) {
    	add(new JLabel(I18NSupport.getString("languages.keys.selection.value")),
        		new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST,
                GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0));
        add(valueField,
        		new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST,
                GridBagConstraints.HORIZONTAL, new Insets(0, 0, 5, 5), 0, 0));
    } else {
    	add(allCheck,
        		new GridBagConstraints(0, 1, 2, 1, 0.0, 0.0, GridBagConstraints.WEST,
                GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0));
    }
}