1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
int fStyle = 0, fSize = 11;
String fName = "";
Component compo = null, compo2 = null
for (a = 0; a <= jMenuBar1.getComponentCount()-1; a++) {
try {
compo = jMenuBar1.getComponent(a); // les menus
fName = compo.getFont().getFontName();
fStyle = compo.getFont().getStyle();
fSize = USINE.taillePolice;
compo.setFont(new Font(fName,fStyle,fSize))
if (compo.getClass() == JMenu.class) { // les menuItems
for (b = 0; b <= ((JMenu)compo).getItemCount()-1; b++) {
compo2 = ((JMenu)compo).getItem(b);
fName = compo2.getFont().getFontName();
fStyle = compo2.getFont().getStyle();
fSize = USINE.taillePolice; // la taille choisie
compo2.setFont(new Font(fName,fStyle,fSize));
}
}
}
catch (Exception ex) {
JOptionPane.showMessageDialog(null, " erreur "+ex);
}
} |
Partager