Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

JSlider on Applet

Posted on 2010-11-13
7
Medium Priority
?
880 Views
Last Modified: 2012-05-10
Hello,

 
public void init() {
      Container content = getContentPane();
      content.setBackground(Color.white);
    content.setLayout(new BorderLayout());
    JPanel panel = new JPanel();
 panel.add(textField);
  //  panel.add(slider);
    panel.setBackground(Color.white);
    addButtons(panel);
    panel.add(stepButton);
    panel.add(resetButton);
    panel.add(slider);
    add(panel, "North");
}

Open in new window


  I'm trying to add a JSlider component to java applet. Its not visible on load . when I click on the component its visible again. I tried everything.

I have a background color for the panel which is not visible.
I'm attaching the snaps and code . The class extends JApplet

-Abhi


 image1
 image2
0
Comment
Question by:abhi376
  • 4
  • 3
7 Comments
 
LVL 92

Expert Comment

by:objects
ID: 34128937
that code looks ok, problem appears like its elsewhere in your code
0
 
LVL 6

Author Comment

by:abhi376
ID: 34128969
I just intialized the slider. I'm not even using it anywhere. Does awt components and swing components togther in a jpanel cause problem ??
0
 
LVL 92

Expert Comment

by:objects
ID: 34128977
yes they can, best not to mix them
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 6

Author Comment

by:abhi376
ID: 34129007
why is the panel background color now showing up ? I set the panel background color to be grey.
0
 
LVL 92

Expert Comment

by:objects
ID: 34129021
add:

panel.setOpaque(true);
0
 
LVL 6

Accepted Solution

by:
abhi376 earned 0 total points
ID: 34134260
It will worked with JApplet and panel. Again Jpanel here messes the things up
0
 
LVL 6

Author Closing Comment

by:abhi376
ID: 34171340
I figured the problem
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
Suggested Courses

782 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question