1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
FontcomboBox.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
if (e.getStateChange() == ItemEvent.SELECTED) {
String chosenFont = (String) FontcomboBox.getSelectedItem();
Integer chosenSize = (Integer) comboBox_2.getSelectedItem();
Font myFont = new Font(chosenFont,
(chckbxBold.isSelected() ? Font.BOLD : Font.PLAIN) | (chckbxNewCheckBox.isSelected() ? Font.ITALIC : Font.PLAIN)
, chosenSize );
textArea.setFont(myFont);
textArea.setFont(new Font((String)FontcomboBox.getSelectedItem(), Font.BOLD,chosenSize ));
}
}
}); |
Partager