use of javax.swing.JComboBox in project pcgen by PCGen.
the class ComboSelectionBox method initComponents.
private void initComponents() {
comboBox = new JComboBox();
setBorder(comboBox.getBorder());
comboBox.setBorder(BorderFactory.createEmptyBorder());
button = new JButton(new ButtonAction());
button.setEnabled(false);
button.setMargin(new java.awt.Insets(0, 0, 0, 0));
add(comboBox, BorderLayout.CENTER);
add(button, BorderLayout.LINE_END);
}
use of javax.swing.JComboBox in project pcgen by PCGen.
the class OverPanel method initComponents.
/**
* This method is called from within the constructor to
* initialize the form.
*/
private void initComponents() {
java.awt.GridBagConstraints gridBagConstraints;
panelScaleConv = new javax.swing.JPanel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
textScale = new JFormattedTextField(nf);
textScale.setColumns(3);
jLabel4 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
textReal = new JFormattedTextField(nf);
textMap = new JFormattedTextField(nf);
butToMap = new javax.swing.JButton();
butToReal = new javax.swing.JButton();
panelTravelTime = new javax.swing.JPanel();
imperialSpeedLabel = new javax.swing.JLabel();
metricSpeedLabel = new JLabel();
cmbFile = new javax.swing.JComboBox();
txtDist = new JFormattedTextField(nf);
txtDist.setColumns(4);
txtDistMetric = new JFormattedTextField(nf);
jLabel11 = new javax.swing.JLabel();
txtTime = new JFormattedTextField(nf);
txtTime.setColumns(4);
butToTime = new javax.swing.JButton();
butToTime2 = new JButton();
butToDist = new javax.swing.JButton();
lblSpeed = new JLabel();
panelRoomBoard = new javax.swing.JPanel();
jLabel15 = new javax.swing.JLabel();
jLabel16 = new javax.swing.JLabel();
jLabel17 = new javax.swing.JLabel();
jLabel18 = new javax.swing.JLabel();
jLabel20 = new javax.swing.JLabel();
jLabel21 = new javax.swing.JLabel();
jLabel22 = new javax.swing.JLabel();
txtDayFood = new JFormattedTextField(gp);
txtDayInn = new JFormattedTextField(gp);
txtDayAnimal = new JFormattedTextField(gp);
txtWeekFood = new JLabel();
txtWeekInn = new JLabel();
txtWeekAnimal = new JLabel();
txtDays = new JFormattedTextField(nf);
txtTotal = new JLabel();
cmbFood = new javax.swing.JComboBox();
cmbInn = new javax.swing.JComboBox();
cmbAnimal = new javax.swing.JComboBox();
jSeparator1 = new javax.swing.JSeparator();
jLabel23 = new javax.swing.JLabel();
jLabel24 = new javax.swing.JLabel();
txtPeop = new JFormattedTextField(nf);
txtAnim = new JFormattedTextField(nf);
txtDayTotal = new JFormattedTextField(nf);
txtWeekTotal = new JLabel();
jLabel25 = new javax.swing.JLabel();
JPanel panel = new JPanel(new java.awt.GridBagLayout());
int gap = 3;
Insets stdInsets = new Insets(gap, gap, gap, gap);
panelScaleConv.setLayout(new java.awt.GridBagLayout());
//$NON-NLS-1$
panelScaleConv.setBorder(BorderFactory.createTitledBorder(LanguageBundle.getString("in_plugin_overland_scaleConverter")));
//$NON-NLS-1$
jLabel2.setText(LanguageBundle.getString("in_plugin_overland_realUnits"));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 2;
gridBagConstraints.gridy = 0;
gridBagConstraints.insets = stdInsets;
panelScaleConv.add(jLabel2, gridBagConstraints);
//$NON-NLS-1$
jLabel3.setText("1");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 1;
gridBagConstraints.insets = stdInsets;
panelScaleConv.add(jLabel3, gridBagConstraints);
textScale.setHorizontalAlignment(SwingConstants.CENTER);
textScale.setValue(1);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 2;
gridBagConstraints.gridy = 1;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.insets = stdInsets;
panelScaleConv.add(textScale, gridBagConstraints);
//$NON-NLS-1$
jLabel4.setText("=");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 1;
gridBagConstraints.insets = stdInsets;
panelScaleConv.add(jLabel4, gridBagConstraints);
//$NON-NLS-1$
jLabel5.setText(LanguageBundle.getString("in_plugin_overland_mapUnits"));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 0;
gridBagConstraints.insets = stdInsets;
panelScaleConv.add(jLabel5, gridBagConstraints);
textReal.addKeyListener(new KeyListenerImplementation(butToMap));
textReal.setHorizontalAlignment(SwingConstants.CENTER);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 2;
gridBagConstraints.gridy = 2;
gridBagConstraints.gridheight = 2;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.insets = stdInsets;
panelScaleConv.add(textReal, gridBagConstraints);
textMap.addKeyListener(new KeyListenerImplementation(butToReal));
textMap.setHorizontalAlignment(SwingConstants.CENTER);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 2;
gridBagConstraints.gridheight = 2;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.insets = stdInsets;
panelScaleConv.add(textMap, gridBagConstraints);
//$NON-NLS-1$
butToMap.setText(LanguageBundle.getString("in_plugin_overland_leftArrow"));
butToMap.addActionListener(this::butToMapActionPerformed);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 2;
panelScaleConv.add(butToMap, gridBagConstraints);
//$NON-NLS-1$
butToReal.setText(LanguageBundle.getString("in_plugin_overland_rightArrow"));
butToReal.addActionListener(this::butToRealActionPerformed);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 3;
panelScaleConv.add(butToReal, gridBagConstraints);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 1;
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
panel.add(panelScaleConv, gridBagConstraints);
// Travel time panel
panelTravelTime.setLayout(new java.awt.GridBagLayout());
//$NON-NLS-1$
panelTravelTime.setBorder(BorderFactory.createTitledBorder(LanguageBundle.getString("in_plugin_overland_travelTime")));
gridBagConstraints = new GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 0;
gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
gridBagConstraints.insets = new Insets(0, 2 * gap, 2 * gap, 2 * gap);
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
panelTravelTime.add(cmbFile, gridBagConstraints);
method = new JComboBox();
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 1;
gridBagConstraints.insets = stdInsets;
gridBagConstraints.gridwidth = 2;
panelTravelTime.add(method, gridBagConstraints);
JPanel terrainRoute = new JPanel(new GridBagLayout());
terrain = new JComboBox();
gridBagConstraints = new GridBagConstraints();
gridBagConstraints.insets = stdInsets;
terrainRoute.add(terrain, gridBagConstraints);
route = new JComboBox();
terrainRoute.add(route, gridBagConstraints);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 5;
gridBagConstraints.gridwidth = 2;
panelTravelTime.add(terrainRoute, gridBagConstraints);
percent = new JLabel();
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 2;
gridBagConstraints.gridy = 5;
gridBagConstraints.insets = stdInsets;
panelTravelTime.add(percent, gridBagConstraints);
JPanel paceChoice = new JPanel(new GridBagLayout());
pace = new JComboBox();
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.insets = stdInsets;
paceChoice.add(pace, gridBagConstraints);
choice = new JComboBox();
paceChoice.add(choice, gridBagConstraints);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 2;
gridBagConstraints.anchor = GridBagConstraints.LINE_START;
gridBagConstraints.gridwidth = 2;
gridBagConstraints.gridheight = 2;
panelTravelTime.add(paceChoice, gridBagConstraints);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 2;
gridBagConstraints.gridy = 2;
gridBagConstraints.insets = stdInsets;
panelTravelTime.add(imperialSpeedLabel, gridBagConstraints);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 2;
gridBagConstraints.gridy = 3;
gridBagConstraints.insets = stdInsets;
panelTravelTime.add(metricSpeedLabel, gridBagConstraints);
// "Special rules stuff will go there. This is used as default column name."
ruleComment = new JTextArea();
ruleComment.setRows(3);
ruleComment.setEditable(false);
ruleComment.setFocusable(false);
ruleComment.setLineWrap(true);
// TODO i18n this. this is not correct in non spaced language like Japanese, unless it is done correctly by Java?
ruleComment.setWrapStyleWord(true);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 4;
gridBagConstraints.gridwidth = 2;
gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START;
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
panelTravelTime.add(new JScrollPane(ruleComment), gridBagConstraints);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 2;
gridBagConstraints.gridy = 6;
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
// XXX use a line or a component that make more sense than this menu component
panelTravelTime.add(new JSeparator(), gridBagConstraints);
imperialSpeed = new JLabel();
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 2;
gridBagConstraints.gridy = 7;
panelTravelTime.add(imperialSpeed, gridBagConstraints);
metricSpeed = new JLabel();
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 2;
gridBagConstraints.gridy = 8;
panelTravelTime.add(metricSpeed, gridBagConstraints);
JPanel conversion = new JPanel(new GridBagLayout());
txtDist.addKeyListener(new KeyListenerImplementation(butToTime));
txtDist.setHorizontalAlignment(SwingConstants.CENTER);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 0;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.insets = stdInsets;
conversion.add(txtDist, gridBagConstraints);
//$NON-NLS-1$
JLabel miles = new JLabel(LanguageBundle.getString("in_plugin_overland_fieldMiles"));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 0;
gridBagConstraints.insets = new java.awt.Insets(gap, 0, gap, gap);
conversion.add(miles, gridBagConstraints);
//$NON-NLS-1$
butToTime.setText(LanguageBundle.getString("in_plugin_overland_rightArrow"));
butToTime.setEnabled(false);
butToTime.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent evt) {
butImperialToTimeActionPerformed();
}
});
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 2;
gridBagConstraints.gridy = 0;
conversion.add(butToTime, gridBagConstraints);
txtDistMetric.addKeyListener(new KeyListenerImplementation(butToTime2));
txtDistMetric.setHorizontalAlignment(SwingConstants.CENTER);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 1;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.insets = stdInsets;
conversion.add(txtDistMetric, gridBagConstraints);
//$NON-NLS-1$
lblSpeed.setText(LanguageBundle.getString("in_plugin_overland_fieldKm"));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 1;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
gridBagConstraints.insets = new java.awt.Insets(gap, gap, gap, gap);
conversion.add(lblSpeed, gridBagConstraints);
//$NON-NLS-1$
butToTime2.setText(LanguageBundle.getString("in_plugin_overland_rightArrow"));
butToTime2.setEnabled(false);
butToTime.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent evt) {
butMetricToTimeActionPerformed();
}
});
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 2;
gridBagConstraints.gridy = 1;
conversion.add(butToTime2, gridBagConstraints);
txtTime.addKeyListener(new KeyListenerImplementation(butToDist));
txtTime.setHorizontalAlignment(SwingConstants.CENTER);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 4;
gridBagConstraints.gridy = 0;
gridBagConstraints.gridheight = 2;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.insets = new java.awt.Insets(gap, gap, gap, 0);
conversion.add(txtTime, gridBagConstraints);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 5;
gridBagConstraints.gridy = 0;
gridBagConstraints.gridheight = 2;
gridBagConstraints.insets = stdInsets;
conversion.add(jLabel11, gridBagConstraints);
//$NON-NLS-1$
butToDist.setText(LanguageBundle.getString("in_plugin_overland_leftArrow"));
butToDist.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent evt) {
butToDistActionPerformed();
}
});
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 3;
gridBagConstraints.gridy = 0;
gridBagConstraints.gridheight = 2;
conversion.add(butToDist, gridBagConstraints);
gridBagConstraints = new GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 8;
gridBagConstraints.gridwidth = 2;
gridBagConstraints.gridheight = 4;
panelTravelTime.add(conversion, gridBagConstraints);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 0;
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
panel.add(panelTravelTime, gridBagConstraints);
// Room and board
panelRoomBoard.setLayout(new java.awt.GridBagLayout());
//$NON-NLS-1$
panelRoomBoard.setBorder(BorderFactory.createTitledBorder(LanguageBundle.getString("in_plugin_overland_roomAndBoard")));
//$NON-NLS-1$
jLabel15.setText(LanguageBundle.getString("in_plugin_overland_perDay"));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 2;
gridBagConstraints.gridy = 3;
gridBagConstraints.insets = stdInsets;
panelRoomBoard.add(jLabel15, gridBagConstraints);
//$NON-NLS-1$
jLabel16.setText(LanguageBundle.getString("in_plugin_overland_food"));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 4;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints.insets = stdInsets;
panelRoomBoard.add(jLabel16, gridBagConstraints);
//$NON-NLS-1$
jLabel17.setText(LanguageBundle.getString("in_plugin_overland_perWeek"));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 3;
gridBagConstraints.gridy = 3;
gridBagConstraints.insets = stdInsets;
panelRoomBoard.add(jLabel17, gridBagConstraints);
//$NON-NLS-1$
jLabel18.setText(LanguageBundle.getString("in_plugin_overland_lodging"));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 5;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints.insets = stdInsets;
panelRoomBoard.add(jLabel18, gridBagConstraints);
// some space between top and middle
gridBagConstraints = new GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 2;
gridBagConstraints.insets = stdInsets;
panelRoomBoard.add(new JPanel(), gridBagConstraints);
//$NON-NLS-1$
jLabel20.setText(LanguageBundle.getString("in_plugin_overland_animals"));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 7;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints.insets = stdInsets;
panelRoomBoard.add(jLabel20, gridBagConstraints);
//$NON-NLS-1$
jLabel21.setText(LanguageBundle.getString("in_plugin_overland_days"));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 10;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints.insets = stdInsets;
panelRoomBoard.add(jLabel21, gridBagConstraints);
gridBagConstraints = new GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 11;
gridBagConstraints.gridwidth = 2;
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
panelRoomBoard.add(new JSeparator(), gridBagConstraints);
//$NON-NLS-1$
jLabel22.setText(LanguageBundle.getString("in_plugin_overland_total"));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 12;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints.insets = stdInsets;
panelRoomBoard.add(jLabel22, gridBagConstraints);
txtDayFood.setHorizontalAlignment(SwingConstants.CENTER);
txtDayFood.addPropertyChangeListener(VALUE_PROPERTY, new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
txtDayFoodActionPerformed();
}
});
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 2;
gridBagConstraints.gridy = 4;
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
gridBagConstraints.insets = stdInsets;
panelRoomBoard.add(txtDayFood, gridBagConstraints);
txtDayInn.setHorizontalAlignment(SwingConstants.CENTER);
txtDayInn.addPropertyChangeListener(VALUE_PROPERTY, new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
txtDayFoodActionPerformed();
}
});
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 2;
gridBagConstraints.gridy = 5;
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
gridBagConstraints.insets = stdInsets;
panelRoomBoard.add(txtDayInn, gridBagConstraints);
txtDayAnimal.setHorizontalAlignment(SwingConstants.CENTER);
txtDayAnimal.addPropertyChangeListener(VALUE_PROPERTY, new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
txtDayFoodActionPerformed();
}
});
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 2;
gridBagConstraints.gridy = 7;
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
gridBagConstraints.insets = stdInsets;
panelRoomBoard.add(txtDayAnimal, gridBagConstraints);
txtWeekFood.setHorizontalAlignment(SwingConstants.CENTER);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 3;
gridBagConstraints.gridy = 4;
gridBagConstraints.insets = stdInsets;
panelRoomBoard.add(txtWeekFood, gridBagConstraints);
txtWeekInn.setHorizontalAlignment(SwingConstants.CENTER);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 3;
gridBagConstraints.gridy = 5;
gridBagConstraints.insets = stdInsets;
panelRoomBoard.add(txtWeekInn, gridBagConstraints);
txtWeekAnimal.setHorizontalAlignment(SwingConstants.CENTER);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 3;
gridBagConstraints.gridy = 7;
gridBagConstraints.insets = stdInsets;
panelRoomBoard.add(txtWeekAnimal, gridBagConstraints);
txtDays.setHorizontalAlignment(SwingConstants.CENTER);
txtDays.addPropertyChangeListener(VALUE_PROPERTY, new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
txtDaysActionPerformed();
}
});
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 2;
gridBagConstraints.gridy = 10;
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
gridBagConstraints.insets = stdInsets;
panelRoomBoard.add(txtDays, gridBagConstraints);
txtTotal.setHorizontalAlignment(SwingConstants.CENTER);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 2;
gridBagConstraints.gridy = 12;
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
gridBagConstraints.insets = stdInsets;
panelRoomBoard.add(txtTotal, gridBagConstraints);
cmbFood.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent evt) {
txtPeopActionPerformed();
}
});
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 4;
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
gridBagConstraints.insets = stdInsets;
panelRoomBoard.add(cmbFood, gridBagConstraints);
cmbInn.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent evt) {
txtPeopActionPerformed();
}
});
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 5;
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
gridBagConstraints.insets = stdInsets;
panelRoomBoard.add(cmbInn, gridBagConstraints);
cmbAnimal.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent evt) {
txtPeopActionPerformed();
}
});
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 7;
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
gridBagConstraints.insets = stdInsets;
panelRoomBoard.add(cmbAnimal, gridBagConstraints);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 8;
gridBagConstraints.gridwidth = 3;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
panelRoomBoard.add(jSeparator1, gridBagConstraints);
//$NON-NLS-1$
jLabel23.setText(LanguageBundle.getString("in_plugin_overland_people"));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 0;
gridBagConstraints.anchor = GridBagConstraints.LINE_START;
gridBagConstraints.insets = stdInsets;
panelRoomBoard.add(jLabel23, gridBagConstraints);
//$NON-NLS-1$
jLabel24.setText(LanguageBundle.getString("in_plugin_overland_animals"));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 1;
gridBagConstraints.anchor = GridBagConstraints.LINE_START;
gridBagConstraints.insets = stdInsets;
panelRoomBoard.add(jLabel24, gridBagConstraints);
txtPeop.setHorizontalAlignment(SwingConstants.CENTER);
txtPeop.setColumns(3);
txtPeop.addPropertyChangeListener(VALUE_PROPERTY, new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
txtPeopActionPerformed();
}
});
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 0;
gridBagConstraints.anchor = GridBagConstraints.LINE_START;
gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
gridBagConstraints.insets = stdInsets;
panelRoomBoard.add(txtPeop, gridBagConstraints);
txtAnim.setHorizontalAlignment(SwingConstants.CENTER);
txtAnim.setColumns(3);
txtAnim.addPropertyChangeListener(VALUE_PROPERTY, new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
txtPeopActionPerformed();
}
});
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 1;
gridBagConstraints.anchor = GridBagConstraints.LINE_START;
gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
gridBagConstraints.insets = stdInsets;
panelRoomBoard.add(txtAnim, gridBagConstraints);
txtDayTotal.setHorizontalAlignment(SwingConstants.CENTER);
txtDayTotal.addPropertyChangeListener(VALUE_PROPERTY, new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
txtDaysActionPerformed();
}
});
txtDayTotal.setEditable(false);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 2;
gridBagConstraints.gridy = 9;
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
gridBagConstraints.insets = stdInsets;
panelRoomBoard.add(txtDayTotal, gridBagConstraints);
txtWeekTotal.setHorizontalAlignment(SwingConstants.CENTER);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 3;
gridBagConstraints.gridy = 9;
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
gridBagConstraints.insets = stdInsets;
panelRoomBoard.add(txtWeekTotal, gridBagConstraints);
//$NON-NLS-1$
jLabel25.setText(LanguageBundle.getString("in_plugin_overland_total"));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 9;
gridBagConstraints.anchor = GridBagConstraints.NORTHWEST;
gridBagConstraints.insets = stdInsets;
panelRoomBoard.add(jLabel25, gridBagConstraints);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 0;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
panel.add(panelRoomBoard, gridBagConstraints);
setLayout(new BorderLayout());
add(new JScrollPane(panel), BorderLayout.CENTER);
}
use of javax.swing.JComboBox in project pcgen by PCGen.
the class NotesView method initComponents.
/**
* 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.
*/
private void initComponents() {
//GEN-BEGIN:initComponents
jSplitPane1 = new FlippingSplitPane();
jScrollPane1 = new JScrollPane();
notesTree = new JTree();
jPanel1 = new JPanel();
jScrollPane2 = new JScrollPane();
editor = new JTextPane();
jPanel2 = new JPanel();
fileBar = new JToolBar();
newButton = new JButton();
saveButton = new JButton();
exportButton = new JButton();
revertButton = new JButton();
deleteButton = new JButton();
clipboardBar = new JToolBar();
cutButton = new JButton();
copyButton = new JButton();
pasteButton = new JButton();
formatBar = new JToolBar();
sizeCB = new JComboBox();
boldButton = new JButton();
italicButton = new JButton();
underlineButton = new JButton();
colorButton = new JButton();
bulletButton = new JButton();
enumButton = new JButton();
imageButton = new JButton();
alignmentBar = new JToolBar();
leftJustifyButton = new JButton();
centerJustifyButton = new JButton();
rightJustifyButton = new JButton();
filePane = new JPanel();
fileLeft = new JButton();
fileRight = new JButton();
filesBar = new JToolBar();
setLayout(new java.awt.BorderLayout());
jSplitPane1.setDividerLocation(175);
jSplitPane1.setDividerSize(5);
jScrollPane1.setViewportView(notesTree);
jSplitPane1.setLeftComponent(jScrollPane1);
jPanel1.setLayout(new java.awt.BorderLayout());
editor.addCaretListener(this::editorCaretUpdate);
jScrollPane2.setViewportView(editor);
jPanel1.add(jScrollPane2, java.awt.BorderLayout.CENTER);
jPanel2.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT, 0, 0));
newButton.setIcon(Icons.stock_new.getImageIcon());
newButton.setToolTipText("New Node");
newButton.setBorder(new EtchedBorder());
newButton.setEnabled(false);
newButton.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent evt) {
newButtonActionPerformed();
}
});
fileBar.add(newButton);
saveButton.setIcon(Icons.stock_save.getImageIcon());
saveButton.setToolTipText("Save Node");
saveButton.setBorder(new EtchedBorder());
saveButton.setEnabled(false);
saveButton.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent evt) {
saveButtonActionPerformed();
}
});
fileBar.add(saveButton);
exportButton.setIcon(Icons.stock_export.getImageIcon());
exportButton.setToolTipText("Export");
exportButton.setBorder(new EtchedBorder());
exportButton.setEnabled(false);
exportButton.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent evt) {
exportButtonActionPerformed();
}
});
fileBar.add(exportButton);
revertButton.setIcon(Icons.stock_revert.getImageIcon());
revertButton.setToolTipText("Revert to Saved");
revertButton.setBorder(new EtchedBorder());
revertButton.setEnabled(false);
revertButton.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent evt) {
revertButtonActionPerformed();
}
});
fileBar.add(revertButton);
deleteButton.setIcon(Icons.stock_broken_image.getImageIcon());
deleteButton.setToolTipText("Delete Node");
deleteButton.setBorder(new EtchedBorder());
deleteButton.setEnabled(false);
deleteButton.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent evt) {
deleteButtonActionPerformed();
}
});
fileBar.add(deleteButton);
jPanel2.add(fileBar);
cutButton.setIcon(Icons.stock_cut.getImageIcon());
cutButton.setToolTipText("Cut");
cutButton.setBorder(new EtchedBorder());
cutButton.addActionListener(this::cutButtonActionPerformed);
clipboardBar.add(cutButton);
copyButton.setIcon(Icons.stock_copy.getImageIcon());
copyButton.setToolTipText("Copy");
copyButton.setBorder(new EtchedBorder());
copyButton.addActionListener(this::copyButtonActionPerformed);
clipboardBar.add(copyButton);
pasteButton.setIcon(Icons.stock_paste.getImageIcon());
pasteButton.setToolTipText("Paste");
pasteButton.setBorder(new EtchedBorder());
pasteButton.addActionListener(this::pasteButtonActionPerformed);
clipboardBar.add(pasteButton);
jPanel2.add(clipboardBar);
sizeCB.setToolTipText("Size");
sizeCB.setBorder(new EtchedBorder());
sizeCB.addActionListener(this::sizeCBActionPerformed);
formatBar.add(sizeCB);
boldButton.setIcon(Icons.stock_text_bold.getImageIcon());
boldButton.setToolTipText("Bold");
boldButton.setBorder(new EtchedBorder());
boldButton.addActionListener(this::boldButtonActionPerformed);
formatBar.add(boldButton);
italicButton.setIcon(Icons.stock_text_italic.getImageIcon());
italicButton.setToolTipText("Italic");
italicButton.setBorder(new EtchedBorder());
italicButton.addActionListener(this::italicButtonActionPerformed);
formatBar.add(italicButton);
underlineButton.setIcon(Icons.stock_text_underline.getImageIcon());
underlineButton.setToolTipText("Underline");
underlineButton.setBorder(new EtchedBorder());
underlineButton.addActionListener(this::underlineButtonActionPerformed);
formatBar.add(underlineButton);
colorButton.setForeground(new java.awt.Color(0, 0, 0));
colorButton.setIcon(Icons.createImageIcon("menu-mode-RGB-alt.png"));
colorButton.setToolTipText("Color");
colorButton.setBorder(new EtchedBorder());
colorButton.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent evt) {
colorButtonActionPerformed();
}
});
formatBar.add(colorButton);
bulletButton.setIcon(Icons.stock_list_bulet.getImageIcon());
bulletButton.setToolTipText("Bulleted List");
bulletButton.setAction(actionListUnordered);
bulletButton.setBorder(new EtchedBorder());
formatBar.add(bulletButton);
enumButton.setIcon(Icons.stock_list_enum.getImageIcon());
enumButton.setToolTipText("Numbered List");
enumButton.setAction(actionListOrdered);
enumButton.setBorder(new EtchedBorder());
formatBar.add(enumButton);
imageButton.setIcon(Icons.stock_insert_graphic.getImageIcon());
imageButton.setBorder(new EtchedBorder());
imageButton.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent evt) {
imageButtonActionPerformed();
}
});
formatBar.add(imageButton);
jPanel2.add(formatBar);
leftJustifyButton.setIcon(Icons.stock_text_align_left.getImageIcon());
leftJustifyButton.setToolTipText("Left Justify");
leftJustifyButton.setBorder(new EtchedBorder());
leftJustifyButton.addActionListener(this::leftJustifyButtonActionPerformed);
alignmentBar.add(leftJustifyButton);
centerJustifyButton.setIcon(Icons.stock_text_align_center.getImageIcon());
centerJustifyButton.setToolTipText("Center");
centerJustifyButton.setBorder(new EtchedBorder());
centerJustifyButton.addActionListener(this::centerJustifyButtonActionPerformed);
alignmentBar.add(centerJustifyButton);
rightJustifyButton.setIcon(Icons.stock_text_align_right.getImageIcon());
rightJustifyButton.setToolTipText("Right Justify");
rightJustifyButton.setBorder(new EtchedBorder());
rightJustifyButton.addActionListener(this::rightJustifyButtonActionPerformed);
alignmentBar.add(rightJustifyButton);
jPanel2.add(alignmentBar);
jPanel1.add(jPanel2, java.awt.BorderLayout.NORTH);
filePane.setLayout(new BoxLayout(filePane, BoxLayout.X_AXIS));
fileLeft.setText("<");
fileLeft.setBorder(new EtchedBorder());
fileLeft.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent evt) {
fileLeftActionPerformed();
}
});
filePane.add(fileLeft);
fileRight.setText(">");
fileRight.setBorder(new EtchedBorder());
fileRight.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent evt) {
fileRightActionPerformed();
}
});
filePane.add(fileRight);
filePane.add(filesBar);
jPanel1.add(filePane, java.awt.BorderLayout.SOUTH);
jSplitPane1.setRightComponent(jPanel1);
add(jSplitPane1, java.awt.BorderLayout.CENTER);
}
use of javax.swing.JComboBox in project Info-Evaluation by TechnionYP5777.
the class InteractiveFrame method addEventButtonOnClick.
public void addEventButtonOnClick() {
btnAddEvent.addActionListener(l -> {
inputAccepted = false;
String input = txtEnterYourEvent.getText();
if (!"".equals(input))
try {
txtEnterYourEvent.setText("Loading please wait...");
events.addSource(input, "2017");
txtEnterYourEvent.setText(input);
} catch (Exception e) {
txtEnterYourEvent.setText("Could not parse, please try again");
return;
}
inputAccepted = true;
for (InteractiveTableTuple itt : events.getInteractiveData()) {
Object[] e = new Object[3];
e[0] = itt.getName();
e[1] = utilDateToSQLDateConvertor(itt.getRegularDate());
JComboBox<String> reasonsOptions = new JComboBox<>();
itt.getReasons().stream().forEach(x -> reasonsOptions.addItem(x.getReason()));
reasonsOptions.setVisible(true);
txtEnterYourEvent.setText("Click to choose the most suitable reason");
table.getColumnModel().getColumn(2).setCellEditor(new DefaultCellEditor(reasonsOptions));
e[2] = itt.getReasons().get(0).getReason();
((DefaultTableModel) table.getModel()).addRow(e);
}
});
}
use of javax.swing.JComboBox in project voltdb by VoltDB.
the class FontDialogSwing method creatFontDialog.
/**
* Create and display FontDialogSwing Dialog.
*
*/
public static void creatFontDialog(DatabaseManagerSwing owner) {
if (isRunning) {
frame.setVisible(true);
} else {
CommonSwing.setSwingLAF(frame, CommonSwing.Native);
fOwner = owner;
frame.setIconImage(CommonSwing.getIcon("Frame"));
isRunning = true;
frame.setSize(600, 100);
CommonSwing.setFramePositon(frame);
ckbitalic = new JCheckBox(new ImageIcon(CommonSwing.getIcon("ItalicFont")));
ckbitalic.putClientProperty("is3DEnabled", Boolean.TRUE);
ckbitalic.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
setStyle();
}
});
ckbbold = new JCheckBox(new ImageIcon(CommonSwing.getIcon("BoldFont")));
ckbbold.putClientProperty("is3DEnabled", Boolean.TRUE);
ckbbold.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
setStyle();
}
});
fgColorButton = new JButton("Foreground", new ImageIcon(CommonSwing.getIcon("ColorSelection")));
fgColorButton.putClientProperty("is3DEnabled", Boolean.TRUE);
fgColorButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
setColor(FOREGROUND);
}
});
bgColorButton = new JButton("Background", new ImageIcon(CommonSwing.getIcon("ColorSelection")));
bgColorButton.putClientProperty("is3DEnabled", Boolean.TRUE);
bgColorButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
setColor(BACKGROUND);
}
});
closeButton = new JButton("Close", new ImageIcon(CommonSwing.getIcon("Close")));
closeButton.putClientProperty("is3DEnabled", Boolean.TRUE);
closeButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
frame.setVisible(false);
}
});
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
String[] fontNames = ge.getAvailableFontFamilyNames();
Dimension fontsComboBoxDimension = new Dimension(160, 25);
fontsComboBox = new JComboBox(fontNames);
fontsComboBox.putClientProperty("is3DEnabled", Boolean.TRUE);
fontsComboBox.setMaximumSize(fontsComboBoxDimension);
fontsComboBox.setPreferredSize(fontsComboBoxDimension);
fontsComboBox.setMaximumSize(fontsComboBoxDimension);
fontsComboBox.setEditable(false);
fontsComboBox.setSelectedItem(defaultFont);
fontsComboBox.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
setFont();
}
});
// weconsultants@users 20050215 - Added for Compatbilty fix for JDK 1.3
fontSizesComboBox = new JComboBox(fontSizes);
Dimension spinnerDimension = new Dimension(45, 25);
fontSizesComboBox.putClientProperty("is3DEnabled", Boolean.TRUE);
fontSizesComboBox.setMinimumSize(spinnerDimension);
fontSizesComboBox.setPreferredSize(spinnerDimension);
fontSizesComboBox.setMaximumSize(spinnerDimension);
fontSizesComboBox.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent evt) {
if (evt.getStateChange() == ItemEvent.SELECTED) {
setFontSize((String) evt.getItem());
}
}
});
// weconsultants@users 20050215 - Commented out for Compatbilty fix for JDK 1.3
// Dimension spinnerDimension = new Dimension(50, 25);
// spinnerFontSizes = new JSpinner();
// spinnerFontSizes.putClientProperty("is3DEnabled", Boolean.TRUE);
// spinnerFontSizes.setMinimumSize(spinnerDimension);
// spinnerFontSizes.setPreferredSize(spinnerDimension);
// spinnerFontSizes.setMaximumSize(spinnerDimension);
// spinnerModelSizes = new SpinnerNumberModel(12, 8, 72, 1);
// spinnerFontSizes.setModel(spinnerModelSizes);
// spinnerFontSizes.addChangeListener(new ChangeListener() {
// public void stateChanged(ChangeEvent e) {
// setFontSize();
// }
// });
Container contentPane = frame.getContentPane();
contentPane.setLayout(new FlowLayout());
contentPane.add(fontsComboBox);
// weconsultants@users 20050215 - Commented out for Compatbilty fix for 1.3
// contentPane.add(spinnerFontSizes);
// weconsultants@users 20050215 - Added for Compatbilty fix for 1.3
contentPane.add(fontSizesComboBox);
contentPane.add(ckbbold);
contentPane.add(ckbitalic);
contentPane.add(fgColorButton);
contentPane.add(bgColorButton);
contentPane.add(closeButton);
frame.pack();
frame.setVisible(false);
}
}
Aggregations