The ProgrammersTalk Community
Forum Register Search Today's Posts Mark Forums Read
Register

Go Back   The ProgrammersTalk Community > General Programming > Java


Welcome to the The ProgrammersTalk Community forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.
Tags:

Closed Thread
 
LinkBack Thread Tools    Display Modes   
  #1 (permalink)  
Old 08-25-2007, 03:06 PM
devil777
Posts: n/a
[SOLVED] Jslider

Hey is there any one who can help with this
I have to plot sliderbar that h as 3 pointers on bar for the 3 grades a,b,c on a scale of 100 for the class
On the left side of it i need to have the name of the students with rectangular projection of the grade( like if a student got 85 % his individual rectangular bar must be upto 83 % level of the slider bar etc )
these 3 pointers for a, b ,c grade must be movable like i can adjust my own values for the grades on the same slider

i need help i need to complete this by monday
please help me

__________________

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
  #2 (permalink)  
Old 08-26-2007, 12:52 AM
HelloWorld's Avatar
HelloWorld HelloWorld is offline
PT Admin
Awards Showcase
Quality Tutorial 
Total Awards: 1
Join Date: Jun 2007
Location: In front of computer...
Posts: 1,119
iTrader: (0)
HelloWorld is a jewel in the roughHelloWorld is a jewel in the roughHelloWorld is a jewel in the rough
Well, I believe that there's no one here who loves doing others' homework for free. However, I believe you can look for programmers in the Freelance Jobs section of the forum though...

I'd suggest you post the current code of what you have

__________________
PHP Code:
System.out.println("Hello World!"); 

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
  #3 (permalink)  
Old 08-26-2007, 04:36 AM
devil777
Posts: n/a
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.GridLayout;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JSlider;
import javax.swing.SwingConstants;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
public class SliderFrame extends JFrame
{
public static JSlider diameterJSlider; // slider to select diameter
// panel to draw circle
// no-argument constructor
public SliderFrame()
{
super ( "Student chart" );
add(new Test());
add(new Test2());

setLayout(new BorderLayout());
JLabel n = new JLabel("true");
JLabel n1 = new JLabel("true1");
n.setForeground( Color.red);
JPanel j = new JPanel();
JPanel j2 = new JPanel();
j.setLayout( new GridLayout(3,0));
//j.add(new JLabel("neeee"));
j2.setLayout( new GridLayout(3,0));
j2.add(new JLabel("namessssss"));
j2.add(n);
j2.add(new JLabel("mary"));
j.add(new Test());
j.add(new Test());
j.add(new Test());

add(j2,BorderLayout.WEST);
add(j,BorderLayout.CENTER);
// set up JSlider to control diameter value
diameterJSlider =
new JSlider( SwingConstants.HORIZONTAL, 0, 100, 0 );
JSlider diameterJSlider1 =
new JSlider( SwingConstants.HORIZONTAL, 0, 100, 0 );
diameterJSlider1.setForeground(Color.BLUE);
diameterJSlider1.setMajorTickSpacing( 20 ); // create tick every 10
diameterJSlider1.setPaintTicks( true ); // paint ticks on slider
diameterJSlider1.setPaintLabels(true);

diameterJSlider.setMajorTickSpacing( 10 ); // create tick every 10
diameterJSlider.setPaintTicks( true ); // paint ticks on slider
diameterJSlider.setPaintLabels(true);
diameterJSlider.add(new NewPanel());


JSlider diameterJSlider3 =
new JSlider( SwingConstants.HORIZONTAL, 0, 100, 0 );
JSlider diameterJSlider4 =
new JSlider( SwingConstants.HORIZONTAL, 0, 100, 0 );
diameterJSlider3.setMajorTickSpacing( 20 ); // create tick every 10
diameterJSlider3.setPaintTicks( true ); // paint ticks on slider
diameterJSlider3.setPaintLabels(true);

diameterJSlider4.setMajorTickSpacing( 10 ); // create tick every 10
diameterJSlider4.setPaintTicks( true ); // paint ticks on slider
diameterJSlider4.setPaintLabels(true);
diameterJSlider4.add(new NewPanel());
diameterJSlider4.setForeground(Color.red);
diameterJSlider3.setForeground(Color.ORANGE);
diameterJSlider.setForeground(Color.CYAN);

diameterJSlider.add("aaa",new JLabel("a"));
diameterJSlider.addChangeListener(

new ChangeListener() // anonymous inner class
{
// handle change in slider value
public void stateChanged( ChangeEvent e )
{
//myPanel.setDiameter( diameterJSlider.getValue() );
} // end method stateChanged
} // end anonymous inner class
);
JPanel j3 = new JPanel();
j3.setLayout(new GridLayout(2,2));
JLabel a = new JLabel(" A grade");
JLabel b = new JLabel(" B grade");
j3.add(a);



j3.add(diameterJSlider);
j3.add(b);
j3.add(diameterJSlider1);

add( j3,BorderLayout.SOUTH);

JPanel j4 = new JPanel();
add( j4,BorderLayout.NORTH);
j4.setLayout(new GridLayout(2,2,0,0));
JLabel c = new JLabel(" D grade");
JLabel d = new JLabel(" C grade");
j4.add(c);



j4.add(diameterJSlider3);
j4.add(d);
j4.add(diameterJSlider4);


// add( diameterJSlider1,BorderLayout.NORTH);
// j2.add(diameterJSlider);


} // end SliderFrame constructor
public static void main( String args[] )
{
SliderFrame sliderFrame = new SliderFrame();
sliderFrame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
sliderFrame.setSize( 800, 270 ); // set frame size
sliderFrame.setVisible( true ); // display frame
} //
class NewPanel extends JPanel {
protected void paintComponent(Graphics g) {
super.paintComponent(g);
g.drawLine(0, 0, 50, 50);
g.drawRect(0, 0, 100, 10);
}
} //
}


import
java.awt.Color;

import
java.awt.Graphics;

import
java.awt.*;

import
javax.swing.*;



public
class Test extends JPanel {

publicvoid paintComponent(Graphics g) {
super.paintComponent(g);
boolean color=true;
g.setColor(Color.
black);

g.setColor(Color.
green);

g.fillRect(SliderFrame.
diameterJSlider.get), SliderFrame.diameterJSlider.getY()+100, 200, 10);
// g.fillRect(200, 70, 200, 10);

g.fillOval(400, 70, 10,10);
// g.fillRect(SliderFrame.diameterJSlider.get), SliderFrame.diameterJSlider.get), 5, 50);




}
}



This is the code that i have somebody could please help me out with this
I thought that this is the site where you can disscuss ur stuff nad not pay

__________________

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
  #4 (permalink)  
Old 08-26-2007, 01:16 PM
HelloWorld's Avatar
HelloWorld HelloWorld is offline
PT Admin
Awards Showcase
Quality Tutorial 
Total Awards: 1
Join Date: Jun 2007
Location: In front of computer...
Posts: 1,119
iTrader: (0)
HelloWorld is a jewel in the roughHelloWorld is a jewel in the roughHelloWorld is a jewel in the rough
Quote:
I thought that this is the site where you can disscuss ur stuff nad not pay
you can, but you didn't even post ur code -.-" lol...

anyways, how do you want to pull up the grades for each student? Do you store the grade in database? Do you just pass it through the command line like:

Code:
java Grade john 50 nancy 25 ricky 85
or how?

__________________
PHP Code:
System.out.println("Hello World!"); 

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!

Last edited by HelloWorld : 08-26-2007 at 01:23 PM.
  #5 (permalink)  
Old 08-26-2007, 02:20 PM
devil777
Posts: n/a
No i store everything in arrays and in the form of files.

__________________

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
  #6 (permalink)  
Old 08-26-2007, 02:22 PM
devil777
Posts: n/a
No i store everything in arrays and in the form of files. but if you can help me with this where i just need to connect the pointer ofthe slider with a single line tha moves across the screen with the movement of the slider pointer that would be a help.
I just need to make that work.
Rest i have working

__________________

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
  #7 (permalink)  
Old 08-26-2007, 02:56 PM
HelloWorld's Avatar
HelloWorld HelloWorld is offline
PT Admin
Awards Showcase
Quality Tutorial 
Total Awards: 1
Join Date: Jun 2007
Location: In front of computer...
Posts: 1,119
iTrader: (0)
HelloWorld is a jewel in the roughHelloWorld is a jewel in the roughHelloWorld is a jewel in the rough
I haven't personally tested your code since I'm now very busy with final exam tomorrow lol... But I'd suggest to use this to set the current value of the slider:

Code:
void 	setValue(int n)
          Sets the sliders current value.
where N is the number that you got from the array for the specified user.
Let me know if it works and the problem that you're encountering... Sorry, I can't help much now but by just giving you abstract implementation.. hope that helps you

__________________
PHP Code:
System.out.println("Hello World!"); 

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
Closed Thread


Thread Tools
Display Modes

   Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -7. The time now is 07:38 AM. Powered by vBulletin
Copyright © 2000 - 2007, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO © 2007 ProgrammersTalk Sedo - Buy and Sell Domain Names and Websites project info: programmerstalk.net Statistics for project programmerstalk.net etracker® web controlling instead of log file analysis


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50