473,385 Members | 1,356 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,385 software developers and data experts.

Gui is not drawn properly, help?

Hi.
i am currently learning GUI.
have learn how to draw button, panel, frames

but the problem was, when i run the simple program.
all the interface is not drawn properly, or atleast it is draw very slowly
and not reacting to action fast enough..
There must be a way to fix this, can any1 tell me?
here is my simple code, but gui is slow and not responding well when i drag
it in side the monitor;

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class Frame1 extends JFrame{
JPanel jPanel1 = new JPaneal();
JButton jButton1 = new JButton();
public Frame1(){
super("example");
setSize(500,500);
this.getContentpane().add(jPanel1, BorderLayout.SOUTH);
jPanel1.add(jButton1);

public static void main(String[] args){
Frame1 frame1 = new Frame1();
frame1.setVisible(true);
}
}

thanks alot

Leon
Jul 17 '05 #1
1 1732
Hi Leon,
I am surprised that the program you have given even compiled ... but
any way i made some minor changes ... mostly spelling mistakes or case
mistakes .. and ran it ... it wirks without a hitch ... and speed is
also pretty good.

heres the code
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class Frame1 extends JFrame
{
JPanel jPanel1 = new JPanel();
JButton jButton1 = new JButton();
public Frame1()
{
super("example");
setSize(500,500);
this.getContentPane().add(jPanel1, BorderLayout.SOUTH);
jPanel1.add(jButton1);
}

public static void main(String[] args)
{
Frame1 frame1 = new Frame1();
frame1.setVisible(true);
}
}

"Leon" <na**@hotmail.com> wrote in message news:<Ag*****************@news01.bloor.is.net.cabl e.rogers.com>...
Hi.
i am currently learning GUI.
have learn how to draw button, panel, frames

but the problem was, when i run the simple program.
all the interface is not drawn properly, or atleast it is draw very slowly
and not reacting to action fast enough..
There must be a way to fix this, can any1 tell me?
here is my simple code, but gui is slow and not responding well when i drag
it in side the monitor;

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class Frame1 extends JFrame{
JPanel jPanel1 = new JPaneal();
JButton jButton1 = new JButton();
public Frame1(){
super("example");
setSize(500,500);
this.getContentpane().add(jPanel1, BorderLayout.SOUTH);
jPanel1.add(jButton1);

public static void main(String[] args){
Frame1 frame1 = new Frame1();
frame1.setVisible(true);
}
}

thanks alot

Leon

Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: TT (Tom Tempelaere) | last post by:
Hi there, I made a custom drawn ComboBox. The DrawItem event handler is (explanation follows) <code> private void OnDrawItem ( object sender, System.Windows.Forms.DrawItemEventArgs e ) {
0
by: Brian Henry | last post by:
any examples of a custom drawn data bound listbox? i am haveing problems getting it to draw the displaymember on the listbox and return the valuemember properly... keep getting exceptions like...
2
by: matko | last post by:
(Due to absolutely no response in ms.pub.dotnet.general, I'm reposting here...) When I call the following function, the rectangle will overlap the graphics that is drawn _afterwards_. Why is...
4
by: Yash | last post by:
Have used DrawLine() method to draw some lines in the picturebox (sort of a barcode) in the picturebox paint event. This diagram has to be saved as an image in bmp or tiff format. But the problem...
2
blazedaces
by: blazedaces | last post by:
Hey, I have an application that draws a polyline with Graphics': g.drawPolyline(getXPoints(),getYPoints(),nPoints); It's drawn onto a background image and so the background image is so many...
3
by: =?Utf-8?B?UmF5IE1pdGNoZWxs?= | last post by:
I'm drawing text using the DrawString method. I need a way to go back and erase one or more characters. As a first thought it seemed that one way to do it would be to go back to the character(s)...
3
by: NickP | last post by:
Hi there, I have a usercontrol that inherits from Windows.Forms.Button. In the OnCreateControl method I set the style of the control so that it supports transparent backcolor and set the...
0
by: MasterOfTheDark | last post by:
This one's a hairy one to explain. What I've got is a class called "VistaGroupBox" that I put some nice-looking Vista-style gradients in the background and made to look like the ribbon categories...
10
by: eddie tan | last post by:
Hi, I have a picturebox with graphics drawn from different objects. In one object I used Pen P1; P1 = new Pen(Color.Blue, 3); Graphics g = null; g = Graphics.FromImage(image.Image);...
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...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.