sorry for posting lots of threads, i dont intend to spam but i need to finish this one as soon as possible, because i have to make 3 programs for this semester in 2 different subjects, i need urgent guides and answers..
well for this one... how can i display this frame in the middle of the sreen?
------- what ever the size would be.. i want to display this frame in the middle of the screen in different monitor (screen), i dont want to set it just by calculating the dimension of MY monitor(screen), "what if i run this in our school..? those monitor's dimension is ranging from 20 someting or regular CRT monitor screen, i have 17 inch here... so i need some answers on how can i display this in the center of different monitors...
public class InventoryServer extends JFrame { private Toolkit toolkit; private Dimension windowSize; private JPanel panelSample; private Image icon; public InventoryServer() { toolkit = Toolkit.getDefaultToolkit(); icon = new ImageIcon("c:/pics/mercuryLogo.jpg").getImage().getScaledInstance(300, 300, 0); windowSize = toolkit.getScreenSize(); panelSample = new JPanel(); } public void setComponents(Container cont) { } public void initializeServer() { this.setLocationByPlatform(true); this.setIconImage(icon); this.setTitle("Inventory Server"); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setComponents(this.getContentPane()); this.setBounds(0, 0, 400, 500); this.setVisible(true); } public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { InventoryServer iS = new InventoryServer(); public void run() { iS.initializeServer(); } }); } }