Results 1 to 9 of 9
- 01-29-2009, 12:21 PM #1
Member
- Join Date
- Jan 2009
- Posts
- 4
- Rep Power
- 0
only ~200x200px Applet area visible
Hi Everybody,
I'm writing a GUI in Java under Linux (FC 9) using Easy Eclipse Desktop Java 1.2.2.
I'm still not a Java expert, so I depend much on Visual Editor. I'm planning to embed my GUI on a web page, so I chose Applet.
The problem is as mentioned in the topic. When I "Run As Java Applet" I see an Applet window with the dimensions I declared, but there's only a limited area (200x200px visible), the rest is just gray:
212.67.142.162/pub/zrzutekranu.png (sorry for that, but I'm not allowed to post links to photos)
EDIT:--------
alternative link: www[dot]fotosik[dot]pl/showFullSize.php?id=ad892da888429074
---------------
And here's my example code:
What could be the problem?Java Code:import java.awt.BorderLayout; import javax.swing.JPanel; import javax.swing.JApplet; import javax.swing.JTextPane; import javax.swing.JButton; import java.awt.Dimension; import java.awt.event.KeyEvent; public class Problem extends JApplet { private JPanel jContentPane = null; private JTextPane jTextPane = null; private JButton jButton = null; private JButton jButton1 = null; /** * This is the xxx default constructor */ public Problem() { super(); } /** * This method initializes this * * @return void */ public void init() { this.setSize(300, 200); this.setContentPane(getJContentPane()); } /** * This method initializes jContentPane * * @return javax.swing.JPanel */ private JPanel getJContentPane() { if (jContentPane == null) { jContentPane = new JPanel(); jContentPane.setLayout(new BorderLayout()); jContentPane.add(getJTextPane(), BorderLayout.CENTER); jContentPane.add(getJButton(), BorderLayout.SOUTH); jContentPane.add(getJButton1(), BorderLayout.NORTH); } return jContentPane; } /** * This method initializes jTextPane * * @return javax.swing.JTextPane */ private JTextPane getJTextPane() { if (jTextPane == null) { jTextPane = new JTextPane(); } return jTextPane; } /** * This method initializes jButton * * @return javax.swing.JButton */ private JButton getJButton() { if (jButton == null) { jButton = new JButton(); jButton.setPreferredSize(new Dimension(34, 30)); jButton.setMnemonic(KeyEvent.VK_UNDEFINED); } return jButton; } /** * This method initializes jButton1 * * @return javax.swing.JButton */ private JButton getJButton1() { if (jButton1 == null) { jButton1 = new JButton(); jButton1.setPreferredSize(new Dimension(34, 30)); jButton1.setText("ABCDEFGHIJKLMNOP1234567890"); } return jButton1; } }
I will appreciate any of your help or hints.
Best regards
jumper
PS. When I do "Applet -> Clone..." from Applet's menu it works fine...Last edited by jumper19; 01-29-2009 at 05:44 PM.
- 01-29-2009, 04:20 PM #2
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Did you manually added this applet class into a html page. I cannot see your image, tcp error prompt.
- 01-29-2009, 05:43 PM #3
Member
- Join Date
- Jan 2009
- Posts
- 4
- Rep Power
- 0
- 01-30-2009, 03:05 AM #4
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Seems to me this is something wrong with the applet viewer. Your code is fine. Did you try to add into a html page, you'll see the applet in correct way.
- 01-31-2009, 06:42 PM #5
Member
- Join Date
- Jan 2009
- Posts
- 4
- Rep Power
- 0
Yepp, you were right! :) However something is still "thinking" the applet is 200x200, because the html code that Eclipse generated was:
I had to correct it to 800x480.XML Code:<html> <body> <applet code=Covert.class width="200" height="200" > </applet> </body> </html>
Any way to change the applet viewer?
Thanx a lot
cheers
--
jumper
- 02-01-2009, 04:39 PM #6
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Your applet code, I mean the HTML code above, set the size of the applet into 200 X 200. Since I'm not an Eclipse use I don't know the exact way to do this.
Can you edit the above HTML code? If so try to change them into 800 X 480, size you want to have and try.
-
Eclipse uses (I think) the standard java appletviewer. I'm not sure how to set the applet's size using this though. I'm with you Eranga, just create a simple HTML page and adjust the size in the HTML code.
- 02-02-2009, 01:46 AM #8
Member
- Join Date
- Jan 2009
- Posts
- 4
- Rep Power
- 0
- 02-02-2009, 03:05 AM #9
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
As Fubarable says, IDE use the standard applet viewer. Somehow because of a reason it not functioning properly. If you change the size of the code, it's effected on the applet viewer. On side side it's working fine.
Similar Threads
-
Nodes and edges..making visible and invisible based on distance
By sfaiz in forum Java AppletsReplies: 2Last Post: 04-14-2009, 10:01 PM -
Address bar not visible
By Akashchopra521 in forum New To JavaReplies: 0Last Post: 12-03-2008, 07:13 AM -
constructor ... is not visible
By emceenugget in forum New To JavaReplies: 2Last Post: 09-27-2008, 05:12 AM -
How do you keep multiple popups visible?
By Jacob Abernathy in forum New To JavaReplies: 6Last Post: 09-15-2008, 06:35 PM -
Added JAR File is not visible in programs (Eclipse Europa/JBoss4.2.2 GA/EJB3.0)
By Ramesh in forum EclipseReplies: 0Last Post: 08-04-2008, 12:17 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks