suraya ya'acob

Greenhorn
+ Follow
since May 10, 2003
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by suraya ya'acob

Hi,

I want to use insets instead of using ManagerLayout to manage the components (mostly JPanel, JLabel, Shape and Line) in my frame.

Please sombody guide me with the simple coding.

Tq
18 years ago
Hi,

I m having rectangle and line in my JPanel.
The question is, can mouseListener work on that things?
for the example, let say i click the rectangle - popup message will appear. Please help me and sample coding will help a lot

then can that things also works in ZoomPanel?
Tq
18 years ago
Hi,
I'm designing the system. So for each user's data appear , the user's picture also appear.
let say John's data appear, so john's picture will appear, if Mary's data appear then Mary's picture will appear.
I have no idea for that.
Can anybody help me, some sample coding will help a lot!
Thank u...
I have an interface which content many panels. So i want to maximize and minimize the panels.
let say the real size of panel is 400 x 400 pixel, then i want to minimize to 400 x 20 pixel.
But the panel is dynamic, i can maximize and minimize again and again...
Thank you.
20 years ago
I'm quite familiar on how to retrieve and make the picture appear using Icon
but the thing is I want to get different picture for different user.
let say John's data so John's picture will appear, if Mary's data then Mary's picture will appear..
thank u...
20 years ago
I'm quite familiar on how to retrieve and make the picture appear using Icon
but the thing is I want to get different picture for different user.
let say John's data so John's picture will appear, if Mary's data then Mary's picture will appear..
thank u...
20 years ago
I have many panel in one screen. Each panel has buttons, labels and etc. So how to hide and unhide every panel?
Thank you
20 years ago
How to get and make the picture appear using java? Let say user id is 123, then I want to get 123’s picture . Can someone show me with coding sample.
Thank you..
20 years ago
Hi,
I've got a problem to pass values from database to an array.
I retrieved values from the database using while (rs.next()), then I want to pass all the values to an array.
The problem is I will get the looping array that depends on the values i've got from database. Let say i've got 10 values then i will get 10 arrays and only index 0 each array contain value.
please help me.
here is my coding sample.
********************
database
year
1999
2000
2001
2002
2003
****************main class*************

*************arr class*********

[ September 30, 2003: Message edited by: Gregg Bolinger ]
Hi,
Can I setWidth and setHeight for JPanel?
and the i want to use Button Scroll to manipulate that panel.
Can anybody show me some example on this?
Thank you
20 years ago
Hi,
I want to have many dynamic component but I want to start the component from the same point (0,0).
I've tried coding like below but there is an error.
Can someone please help me..
public class try extends JComponent
{
......
setPreferedSize(new Dimension(0,0,piksel,500));
20 years ago
Hi,
Is class can be loop ?
Here is my coding...
My output should be a few lines depends on data of t_diagnosa1 in database...but the thing is...only 1 line appear in my interface but the output from "system.out.println..." appear the looping data..
let say..t_diagnosa1 have value for "302" and "402" then i should have two lines...
*********mdinamik.java**************
import java.awt.*;
import java.awt.Container;
import java.awt.event.*;
import java.applet.*;
import javax.swing.*;
import javax.swing.JPanel;
import javax.swing.ImageIcon;
import javax.swing.border.*;
import java.awt.image.*;
import java.sql.*;
import java.util.*;
import java.awt.geom.*;
import java.awt.image.*;
import java.text.*;
public class mdinamik extends JFrame{
String starikh;
int tarikh;
int bil;
int piksel;

public mdinamik()
{
Container pane = getContentPane();
pane.setLayout(new FlowLayout());

try
{
String url = "jdbc dbc b2";
Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn = DriverManager.getConnection(url);

Statement stmt = conn.createStatement();

String query = "SELECT t_diagnosa1 FROM diagnosa WHERE nopesakit = '51' ";
ResultSet rs = stmt.executeQuery(query);

while (rs.next() )
{
starikh = rs.getString("t_diagnosa1");
tarikh = Integer.parseInt(starikh);
System.out.println("starikh" + tarikh);

bil = 0;
piksel = 0;

if(tarikh != 102)
{
bil++;
if(tarikh != 202)
{
bil++;
if(tarikh != 302)
{
bil++;
if(tarikh !=402)
{bil++;
}}}}
if(bil == 1)
piksel = 30;
else if(bil == 2)
piksel = 60;
else if(bil == 3)
piksel = 90;
pixel p1 = new pixel (piksel, 20,600);
pane.add(p1);
System.out.println("bil :" + bil);
System.out.println("piksel :" + piksel);
}
conn.close();
}
catch (Exception e) {
System.err.println("dddd");
System.err.println(e.getMessage());
}


setBounds(0,0,904,750);
setVisible(true);
}
public static void main (String args[])
{
mdinamik aya = new mdinamik();
aya.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
*******pixel.java**********************
import javax.swing.*;
import javax.swing.plaf.ComponentUI;
import java.awt.*;
import java.awt.Container;
import java.awt.event.*;
import java.applet.*;
import javax.swing.JPanel;
import javax.swing.ImageIcon;
import javax.swing.border.*;
import java.awt.image.*;
import java.sql.*;
import java.util.*;
import java.awt.geom.*;
import java.awt.image.*;
import java.text.*;

public class pixel extends JComponent {
int piksel, x,x2;
public pixel(int piksel, int x, int x2) {
this.piksel = piksel;
this.x = x;
this.x2 = x2;
this.setPreferredSize(new Dimension(1000,1000));
}

public void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2d=(Graphics2D) g;
g2d.drawLine(piksel,x,piksel,x2);

}

public int getpiksel() {
return piksel;
}
public void setY(int piksel) {
this.piksel = piksel;
}
public int getX() {
return x;
}
public void setX(int x) {
this.x = x;
}

public int getX2() {
return x2;
}
public void setX2(int x2) {
this.x2 = x2;
}

}
20 years ago
Hi,
Is class can be loop ?
Here is my coding...
My output should be a few lines depends on data of t_diagnosa1 in database...but the thing is...only 1 line appear in my interface but the output from "system.out.println..." appear the looping data..
let say..t_diagnosa1 have value for "302" and "402" then i should have two lines...
*********mdinamik.java**************
import java.awt.*;
import java.awt.Container;
import java.awt.event.*;
import java.applet.*;
import javax.swing.*;
import javax.swing.JPanel;
import javax.swing.ImageIcon;
import javax.swing.border.*;
import java.awt.image.*;
import java.sql.*;
import java.util.*;
import java.awt.geom.*;
import java.awt.image.*;
import java.text.*;
public class mdinamik extends JFrame{
String starikh;
int tarikh;
int bil;
int piksel;

public mdinamik()
{
Container pane = getContentPane();
pane.setLayout(new FlowLayout());

try
{
String url = "jdbc dbc b2";
Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn = DriverManager.getConnection(url);

Statement stmt = conn.createStatement();

String query = "SELECT t_diagnosa1 FROM diagnosa WHERE nopesakit = '51' ";
ResultSet rs = stmt.executeQuery(query);

while (rs.next() )
{
starikh = rs.getString("t_diagnosa1");
tarikh = Integer.parseInt(starikh);
System.out.println("starikh" + tarikh);

bil = 0;
piksel = 0;

if(tarikh != 102)
{
bil++;
if(tarikh != 202)
{
bil++;
if(tarikh != 302)
{
bil++;
if(tarikh !=402)
{bil++;
}}}}
if(bil == 1)
piksel = 30;
else if(bil == 2)
piksel = 60;
else if(bil == 3)
piksel = 90;
pixel p1 = new pixel (piksel, 20,600);
pane.add(p1);
System.out.println("bil :" + bil);
System.out.println("piksel :" + piksel);
}
conn.close();
}
catch (Exception e) {
System.err.println("dddd");
System.err.println(e.getMessage());
}


setBounds(0,0,904,750);
setVisible(true);
}
public static void main (String args[])
{
mdinamik aya = new mdinamik();
aya.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
*******pixel.java**********************
import javax.swing.*;
import javax.swing.plaf.ComponentUI;
import java.awt.*;
import java.awt.Container;
import java.awt.event.*;
import java.applet.*;
import javax.swing.JPanel;
import javax.swing.ImageIcon;
import javax.swing.border.*;
import java.awt.image.*;
import java.sql.*;
import java.util.*;
import java.awt.geom.*;
import java.awt.image.*;
import java.text.*;

public class pixel extends JComponent {
int piksel, x,x2;
public pixel(int piksel, int x, int x2) {
this.piksel = piksel;
this.x = x;
this.x2 = x2;
this.setPreferredSize(new Dimension(1000,1000));
}

public void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2d=(Graphics2D) g;
g2d.drawLine(piksel,x,piksel,x2);

}

public int getpiksel() {
return piksel;
}
public void setY(int piksel) {
this.piksel = piksel;
}
public int getX() {
return x;
}
public void setX(int x) {
this.x = x;
}

public int getX2() {
return x2;
}
public void setX2(int x2) {
this.x2 = x2;
}

}
20 years ago
I want to display image(picture) depends on data from database...if I retrieve profile A from dabase then i want to display A's picture...if i retrieve B's profile then i want to diplay B's picture...
thank you
20 years ago