473,321 Members | 1,669 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,321 software developers and data experts.

Implementing a slider and graphics in an applet

Expand|Select|Wrap|Line Numbers
  1. import javax.swing.JApplet;
  2. import java.awt.BorderLayout;
  3. import javax.swing.JSlider;
  4.  
  5. import java.awt.*;
  6. import java.applet.*;
  7.  
  8. public class SliderTest extends JApplet {
  9.     public void init() {
  10.         createGUI();
  11.     }
  12.  
  13.     private void createGUI() {
  14.         JSlider slider = new JSlider(JSlider.VERTICAL, 0, 100, 50);
  15.  
  16.         slider.setMajorTickSpacing(10);
  17.         slider.setMinorTickSpacing(5);
  18.         slider.setPaintTicks(true);
  19.         slider.setPaintLabels(true);
  20.  
  21.         getContentPane().add(slider, BorderLayout.WEST);
  22.     }
  23.  
  24.     public void paint (Graphics g) {
  25.       g.setColor (Color.black);
  26.  
  27.       g.drawArc (250, 250, 100, 100, 0, 90);
  28.     }
  29. }
  30.  

So essentially what I'm trying to do is draw an arc (or rectangle or really any shape) then place a slider on one of the sides of the window (west,east, north, south, etc.)

Any help you can give me is greatly appreciated! (sorry, if this is a stupid question...I'm new to programming)
Jul 3 '14 #1
0 1052

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: James Hong | last post by:
Help please, I try to sending an email from my html page using the java applet. but it give error on most of the PC only very few work, what is the error i make the java applet show as below ...
4
by: timwap | last post by:
I hava a Java Applet that produces a DTMF tone at a certain time of day. There are 4 parameters to the Applet, they are hour = Hour of triggered event 00~23 min = minute of triggered event 00~59...
0
by: Brian Henry | last post by:
Ok I've never implemented a snap location before so I dont really know what im doing wrong here... anyways, I am making a custom slider control that takes dates as its values instead of integers......
4
by: foleyflint | last post by:
Hello, lately I've been trying to make an applet that has a background image and a couple of canvas objects on it holding an image each. I created the class ImageCanvas which extends Canvas adn...
1
by: dishal | last post by:
Can anyone help me please? How do I convert these codes to launch from a JFrame instead of a Java Applet? A simple program where the user can sketch curves and shapes in a variety of...
20
by: fatfatpopo | last post by:
Anyone who understand the codes below, can you please kindly explain to me by adding comments.. thanks in advance // <applet code="ImageSlider" width="400" height="400"></applet> import...
0
by: Home Coder | last post by:
Below is a link to a web page that loads a Java applet (sorry in advance). In the applet, on the bottom there is a pink colored slider. I would like to use/buy an a web version of this slider. Do...
1
by: sheephead86 | last post by:
Hi, I'm pretty new to java, and I have a small problem involving drawing a rectangle on a java applet.Firstly this is not a plea for someone to help me with this peice of work, I just need pointing...
1
by: kummu4help | last post by:
hi, i want to draw rectangle based on mousedrag event. if user dragging the mouse, then the rectangle on the applet should increase or decrease basing on current mouse coordinates. i have the...
1
by: hdivecha | last post by:
i have make a jtree program in java and if the node is circle then the circle can be shown in frame and i have to resize it with slider . plz help me i have done the tree program bt how to get...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.