use of javax.swing.JTextArea in project android_frameworks_base by ResurrectionRemix.
the class ShowDataAction method actionPerformed.
@Override
public void actionPerformed(ActionEvent e) {
// TODO(agampe): Auto-generated method stub
int selRow = Main.getUI().getSelectedDataTableRow();
if (selRow != -1) {
DumpData data = dataTableModel.getData().get(selRow);
Map<String, Set<String>> inv = data.invertData();
StringBuilder builder = new StringBuilder();
// First bootclasspath.
add(builder, "Boot classpath:", inv.get(null));
// Now everything else.
for (String k : inv.keySet()) {
if (k != null) {
builder.append("==================\n\n");
add(builder, k, inv.get(k));
}
}
JFrame newFrame = new JFrame(data.getPackageName() + " " + data.getDate());
newFrame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
newFrame.getContentPane().add(new JScrollPane(new JTextArea(builder.toString())), BorderLayout.CENTER);
newFrame.setSize(800, 600);
newFrame.setLocationRelativeTo(null);
newFrame.setVisible(true);
}
}
use of javax.swing.JTextArea 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.JTextArea in project yyl_example by Relucent.
the class PingMain method main.
public static void main(String[] args) throws Throwable {
JFrame frame = new JFrame();
Container container = frame.getContentPane();
container.setLayout(null);
{
container.add(addComponent(new JLabel("开始IP:"), 10, 10, 60, 20));
container.add(addComponent(beginText = new JTextField(), 60, 10, 90, 20));
beginText.setText("192.168.1.1");
}
{
container.add(addComponent(new JLabel("结束IP:"), 160, 10, 60, 20));
container.add(addComponent(endText = new JTextField(), 210, 10, 90, 20));
endText.setText("192.168.1.254");
}
{
container.add(addComponent(btnExecute = new JButton("PING"), 310, 10, 75, 20));
}
{
container.add(addComponent(btnCancel = new JButton("取消"), 390, 10, 75, 20));
btnCancel.setEnabled(true);
}
{
container.add(addComponent(new JLabel("结果JSON:"), 10, 40, 100, 20));
JScrollPane scroller = addComponent(new JScrollPane(resultText = new JTextArea()), 10, 60, 460, 350);
scroller.setBorder(BorderFactory.createLineBorder(new Color(0xFF0000)));
resultText.setEditable(false);
container.add(scroller);
}
{
btnExecute.addActionListener(new ActionListener() {
//点击转换按钮时候触发
public void actionPerformed(ActionEvent event) {
(thread = new Thread() {
@Override
public void run() {
btnExecute.setEnabled(false);
beginText.setEnabled(false);
endText.setEnabled(false);
btnCancel.setEnabled(true);
try {
long begin = 0;
long end = 0;
try {
begin = getHexIp(beginText.getText());
end = getHexIp(endText.getText());
} catch (Exception e) {
e.printStackTrace();
resultText.setText("IP地址输出错误,只支持IP4!");
return;
}
if (begin < 0 || end < 0 || begin >= 4294967295L || end >= 4294967295L) {
resultText.setText("IP地址输出错误,只支持IP4.");
return;
}
if (begin > end) {
long temp = begin;
begin = end;
end = temp;
}
if (end - begin > 500) {
resultText.setText("IP地址区间过大,一次只支持500个IP");
return;
}
final ConcurrentMap<String, Boolean> map = new ConcurrentHashMap<String, Boolean>();
ExecutorService es = Executors.newFixedThreadPool(20);
final StringBuilder string = new StringBuilder();
resultText.setText("PING:");
final Lock lock = new ReentrantLock();
for (long i = begin; i <= end; i++) {
String value = Long.toHexString(i);
for (; 8 > value.length(); ) {
value = "0" + value;
}
final String ip = value = //
new StringBuilder().append(Integer.parseInt(value.substring(0, 2), 16)).append(//
".").append(Integer.parseInt(value.substring(2, 4), 16)).append(//
".").append(Integer.parseInt(value.substring(4, 6), 16)).append(//
".").append(Integer.parseInt(value.substring(6, 8), 16)).toString();
es.execute(new Runnable() {
@Override
public void run() {
Boolean result = ping(ip);
map.put(ip, result);
try {
lock.lock();
string.append("ping:").append(ip).append("|").append(result).append("\n");
resultText.setText(string.toString());
} finally {
lock.unlock();
}
}
});
}
es.shutdown();
try {
es.awaitTermination(((end - begin) * 5) / 10 + 20, TimeUnit.SECONDS);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
TreeMap<String, Boolean> tmap = new TreeMap<String, Boolean>();
tmap.putAll(map);
string.delete(0, string.length());
for (Map.Entry<String, Boolean> entry : map.entrySet()) {
string.append(entry.getKey()).append(" |").append(entry.getValue()).append("\n");
resultText.setText(string.toString());
}
} catch (Exception e) {
resultText.setText(e.toString());
} finally {
btnExecute.setEnabled(true);
beginText.setEnabled(true);
endText.setEnabled(true);
btnCancel.setEnabled(true);
thread = null;
}
}
}).start();
}
;
});
btnCancel.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event) {
Thread vThread = thread;
if (vThread != null) {
vThread.interrupt();
}
}
});
}
frame.setBounds(100, 100, 485, 450);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setTitle("Ping");
frame.setResizable(false);
frame.setVisible(true);
}
use of javax.swing.JTextArea in project ACS by ACS-Community.
the class CDBLogic method valueChanged.
/**
* Called whenever the value of the selection changes.
* @param event the event that characterizes the change.
*/
public void valueChanged(TreeSelectionEvent event) {
TreePath tp = event.getPath();
String path = stringPath(tp);
Browser.getInstance().setPath(path);
// check that selected node has a corresponding tabbed pane
if (tabbedPanes.containsKey(path)) {
// update selected components
selectedTable = tables.get(path);
selectedTableModel = tableModels.get(path);
selectedXMLArea = (JTextArea) xmls.get(path);
selectedTabbedPane = (JTabbedPane) tabbedPanes.get(path);
// set selected tabbedPane
Browser.getInstance().setRightComp(selectedTabbedPane, true);
} else {
//Browser.getInstance().display(" No tabbed pane available for this node", false);
// set selected components
selectedTabbedPane = null;
selectedTable = null;
selectedTableModel = null;
selectedXMLArea = null;
// set an emty text area
JTextArea empty = new JTextArea();
empty.setBackground(Color.LIGHT_GRAY);
empty.setEditable(false);
Browser.getInstance().setRightComp(empty, false);
}
}
use of javax.swing.JTextArea in project zaproxy by zaproxy.
the class HistoryFilterPlusDialog method getUrlRegxExcScroller.
private JScrollPane getUrlRegxExcScroller() {
if (urlRegxExcScroller == null) {
regexExc = new JTextArea();
regexExc.setRows(5);
urlRegxExcScroller = new JScrollPane(regexExc);
}
return urlRegxExcScroller;
}
Aggregations