This week's book giveaways are in the Jython/Python and Object-Oriented programming forums.
We're giving away four copies each of Machine Learning for Business: Using Amazon SageMaker and Jupyter and Object Design Style Guide and have the authors on-line!
See this thread and this one for details.
Win a copy of Machine Learning for Business: Using Amazon SageMaker and JupyterE this week in the Jython/Python forum
or Object Design Style Guide in the Object-Oriented programming forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
Sheriffs:
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Joe Ess
  • salvin francis
  • fred rosenberger

help with button display

 
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
guys help me out with this..i wrote an japplet code and placed some jbuttons in it..not the problem is that when i load my applet in a browser(or appletviewer) then the buttons dont show up automatically,they only show up when i scroll my mouse over the region where they are supposed to be displayed..why is this so??following is my init function:
public void init(){
setBackground(Color.black);
Container contentPane = getContentPane();
contentPane.setLayout(null);
width = Integer.parseInt(getParameter("width"));
height = Integer.parseInt(getParameter("height"));
v1 = (int)(height/9);
v2 = (int)(0.8*width);
v3 = v1+10;
v4 = v2/2-10;
v5 = v3+50;

But1 = new JButton("Click to read from text file");
But2 = new JButton("Click to read from database");
But3 = new JButton("Click to open database");

contentPane.add(But1);
contentPane.add(But2);
contentPane.add(But3);

But1.addActionListener(this);
But2.addActionListener(this);
But3.addActionListener(this);

//if (!laidOut) {
Insets insets = contentPane.getInsets();
But1.setBounds(v2+20+insets.left,v3+20+insets.top,175,30);
But2.setBounds(v2+20+insets.left,v3+120+insets.top,175,30);
But3.setBounds(v2+20+insets.left,v3+70+insets.top,175,30);
//laidOut = true;
//}
But1.setBackground(Color.lightGray);
But2.setBackground(Color.lightGray);
But3.setBackground(Color.lightGray);
But1.setForeground(Color.blue);
But2.setForeground(Color.blue);
But3.setForeground(Color.blue);
But1.setFont(new Font("TimesRoman",Font.BOLD,11));
But2.setFont(new Font("TimesRoman",Font.BOLD,11));
But3.setFont(new Font("TimesRoman",Font.BOLD,11));
But2.setEnabled(false);
}
regards
karan
 
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Karen,
Once again, I have used your code and had no problems seeing the buttons. You might want to check your browser for update or use at least JDK1.2. I have tried your code on at least three different platform O/S without any problems (Win98, WinNT, Unix).
Regards,
Manfred.
 
karan, chopra
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi manfred..sorry for bothering u again ..but i really dont know why am i having this problem because i have jdk1.3,i am working on win NT with service pack 5.0,my browser is IE5.0 and netscape 6.0 and i have tried it on all the machines around me having win NT but have the same problem..do u think its a browser problem still or something else..
regards
karan
 
Manfred Leonhardt
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Karan,
I am afraid that I don't know how to help you ...
Sorry,
Manfred.
 
karan, chopra
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi manfred..thants ok..thanks anyways for ur help..
regards
karan
 
this llama doesn't want your drama, he just wants this tiny ad for his mama
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!