Ho raggruppato in questa pagina qualche 'chicca' di programmazione che ho raccolto durante gli anni di lavoro come ingegnere informatico.
I linguaggi di programmazione utilizzati sono principalmente Java e SQL anche se conto di aggiungere tips in altri linguaggi, magari anche con i vostri contributi. Ho voluto mette solo quelle routine che permettono di avere un risultato apprezzabile utilizzando pochissime linee di codice...che sono le mie preferite!

I have gathered here some 'gem' of programming that I have collected over the years working as a software engineer. The programming languages used are mainly Java and SQL even if I hope to add tips in other languages, even with your contributions. I posted only those routines that allow for a successful result using very few lines of code ... which are my preferred!


mercoledì 22 aprile 2009

[JAVA] CENTRARE UN COMPONENTE GRAFICO SULLO SCHERMO - CENTER A GUI COMPONENT ON THE SCREEN

public void centerComponentOnScreen(Component component){
  Dimension screenSize=java.awt.Toolkit.getDefaultToolkit().getScreenSize();
  component.setLocation((screenSize.width - component.getWidth()) / 2,screenSize.height - component.getHeight()) / 2);
}

Nessun commento:

Posta un commento