You are not logged in.

#1 2012-11-25 13:54:23

gadget3000
Member
Registered: 2010-05-11
Posts: 18

Java is not displaying JFrame correctly

I'm currently creating a java application and it makes use of JFrames with JPanels drawn directly onto it. I know this works on other machines but on my Arch Linux machine the JFrame is just blank.
I'm currently using the official oracle jdk and jre, but I've tried with openjdk as well. Everything is up to date and I'm using xmonad as my window manager.

Thanks for any help you can give, and let me know if you need any more information.

EDIT:
Here's an example of what type of code isn't functioning properly:

import java.awt*;
import javax.swing.*;

public class JFrameTester {

  public static void main(String[] args) {
   
    JFrame f = new JFrame("A JFrame");
    f.setSize(250, 250);
    f.setLocation(300,200);
    f.getContentPane().add(BorderLayout.CENTER, new JTextArea(10, 40));
    f.getContentPane().add(new JLabel("Testing"));
    f.setVisible(true);
   
  }
 
}

Last edited by gadget3000 (2012-11-25 14:01:30)

Offline

#2 2012-11-25 14:16:56

biltong
Member
From: South Africa
Registered: 2011-09-01
Posts: 116

Re: Java is not displaying JFrame correctly

import java.awt.*;
import javax.swing.*;
public class JFrameTester {  
    public static void main(String[] args) {
    
    JFrame f = new JFrame("A JFrame");
    f.setSize(250, 250);
    f.setLocation(300,200);
    f.getContentPane().add(BorderLayout.CENTER, new JTextArea(10, 40));
    f.getContentPane().add(BorderLayout.NORTH,new JLabel("Testing"));
    f.setVisible(true);
    
  }
  
}

Works for me.

EDIT: Just a thought, did you set java to use a different theme such as your GTK/KDE theme or anything like that? Perhaps everything is there but you can't see it because of your theme. Try change the look and feel to nimbus or something.

Last edited by biltong (2012-11-25 14:28:11)

Offline

#3 2012-11-25 17:01:20

Nepherte
Member
From: Belgium
Registered: 2008-09-09
Posts: 427
Website

Re: Java is not displaying JFrame correctly

Offline

Board footer

Powered by FluxBB