Solved

JSlider on Applet

Posted on 2010-11-13
7
861 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
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

830 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