Topic
IC4NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
No replies
Sara2012
Sara2012
1 Post
ACCEPTED ANSWER

Pinned topic AbstractViewController doesn't work for Java 1.6 and up

‏2012-05-11T05:56:33Z |
I'm using com.ibm.jtc.AbstractViewController for our client side Java application. After I updated the Java version to 1.6, all the view componts (labels, buttons, text...) are dispeared. The following is my test program. there is a text and a button shown on the screen if it's compiled with jre1.5. The text and the button won't show if it's compiled with jre1.6 or jre1.7. Any idea on how to fix the problem? Our jtc.jar is dated as 2001.
import java.awt.Color;
import java.awt.Frame;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.JButton;
import javax.swing.JLabel;

import com.ibm.jtc.AbstractViewController;

public class DisplayTest extends AbstractViewController {
public DisplayTest() {
setSize(800,650);
setVisible(true);
setBackground(Color.white);

JLabel text = new JLabel("Hello World");
text.setVisible(true);
add(text);
JButton but1 = new JButton("Button1");
this.add(but1);
}
public static void main(String[] args) {
try {
Frame frame = new Frame();
DisplayTest dtest = new DisplayTest();
frame.add("Center", dtest);
frame.setSize(dtest.getSize());
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
frame.setVisible(true);
} catch (Throwable exception) {
System.err.println("Exception occurred in main() of JPanel");
exception.printStackTrace(System.out);
}
}
}

Thanks!
Yongqi