Mam następujący problem. Mam tutaj przyciski ustawiające w Notatniku wielkość czcionki (case21-23). Teraz chciałam dodać pogrubienie (case24) i kursywę.
Niestety używając tej samej metody tj. Font.BOLD mogę to zrobić dla jednego wymiaru czcionki.. i moje pytanie.. Jak ustawić pogrubienie dla każdego rozmiaru czcionki?
@Override
public void actionPerformed(ActionEvent e) {
switch (Integer.parseInt(e.getActionCommand())) {
case 11: {
break;
}
case 12: {
break;
}
case 13:
{
System.exit(0);
break;
}
case 21: {
Font f = new Font("Arial",Font.PLAIN,26);
textArea.setFont(f);
break;
}
case 22: {
Font f = new Font("Arial",Font.PLAIN,10);
textArea.setFont(f);
break;
}
case 23: {
Font f = new Font("Arial",Font.PLAIN,18);
textArea.setFont(f);
break;
}
case 24: {
break;
}
case 25: {
break;
}
case 26: {
textArea.setText("");
break;
}
case 31: {
break;
}
case 41: {
textArea.setText("Szanowny Panie \n\n"+textArea.getText());
break;
}
case 42: {
textArea.setText(textArea.getText()+"\n\n Z powaÂżaniem"+"JW");
break;
}
case 51: {
textArea.setBackground(Color.WHITE);
break;
}
case 52: {
textArea.setBackground(Color.YELLOW);
break;
}
case 53: {
textArea.setBackground(Color.GREEN);
break;
}
case 54: {
textArea.setBackground(Color.BLUE);
break;
}
}