|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
hello there
im having issues with a swing interface im making, the program allways loads the frame ive made but only loads the contents of the frame say 3 out of 10 times and when it does load this content it will only load the spesific page content half of those times any though thanks i have cut out some of of the bits which i conisdered to be un important jon Code:
public void startApplication()
{
loadGUI();
}
private void loadGUI()
{
frame = new JFrame (getGuiHeader());
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setResizable(false);
frame.setIconImage(frameLogo);
frame.setLayout (new BorderLayout());
frame.pack();
frame.setVisible(getFrameVisible());
frame.setSize(getGuiXSize(), getGuiYSize());
new HomeScreen();
}
public static void loadScreenTemplate()
{
JButton viewLeageButton = new JButton("View League");
JPanel menuBar = new JPanel();
menuBar.add(viewLeageButton);
frame.getContentPane().add(menuBar, BorderLayout.NORTH);
}
public HomeScreen()
{
guiSetup.loadScreenTemplate();
JPanel mainContent = new JPanel();
JLabel imageLabel = new JLabel(new ImageIcon("footballPitch.png"));
mainContent.add(imageLabel);
guiSetup.frame.getContentPane().add(mainContent, BorderLayout.CENTER);
}
|
|
#2
|
||||
|
||||
|
It looks at a quick glance to me like you are modifying the contents of the content pane but not redrawing the pane. Either add all the components to the frame before calling setVisible() or be sure to call repaint() when you make changes.
~
__________________
Yawmark class Sig{public static void main(String...args){\u0066or(int \u0020$:"vÌÈÊ\"¤¾Àʲ¬Æ\"v¤Î¤\"²¤¨¸¬Æ".to\u0043h\u0061rArray() )System./*goto/*$/%\u0126//^\u002A\u002Fout.print((char)(($>> +(~'"'&'#'))+('<'>>('\\'/'.')/\u002Array.const(~1)\*\u002F)));}} |
|
#3
|
|||
|
|||
|
humm if iv done it right its not wokring
i added frame.repaint(); do i need to pass repaint anything? thanks jon |
|
#4
|
||||
|
||||
|
Quote:
No, but you do need request a repaint at the appropriate place. ~ |
|
#5
|
|||
|
|||
|
i put repaints after the new content is added to a frame
|
|
#6
|
||||
|
||||
|
Quote:
Unfortunately, if your code doesn't yet work, it's because your code is still incorrect. Please post an SSCCE; i.e., the bare minimum amount of code that compiles, runs, and correctly demonstrates only the problem and nothing else (please read the link to make sure you understand). ~ |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Java Help > Swing display issuses |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|