Solved

JSlider on Applet

Posted on 2010-11-13
7
851 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

744 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now