473,587 Members | 2,501 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Java JLabel JPanel Graphics etc...

Hi all,

It's my first post here, so you doubt I have a question :o)

I want to develop a mini graphical editor. Imagine that I have 2 JFrame, I
want to have one with a list of JToggleButton with a ImageIcon and one
called DrawingAeraWind with nothing into.

I would like to be able to draw the ImageIcon of the selected JToggleButton
in the DrawingAeraWind if I click into this window. I would like to be able
to drag and drop the drawn image in the DrawingAeraWind (just to change its
position).

For now, I'm able to do this.

I want to add a functionality to my light editor. I want to add a
JToggleButton which didn't represent a ImageIcon to add in the
DrawingAeraWind but wich represent a link between 2 drawn Images. For
exemple, if I already have drawn 2 images in the DrawingAeraWind and that I
select this new (link) JToggleButton, I want to be able to select the 2
drawn images in the DrawingAeraWind (by clicking on it) and to display a
line (graphic.drawli ne(image1, image2) )between these 2 images.

My problem is that my 'link' line is not visible, or is clipped, etc...

I use some JLabel to represent my drawn Image (to be able to do drag and
drop on it) and I use graphic.drawlin e() for the link line.
ps: excuse my english :o) I hope you have understand my problem.
Jul 17 '05 #1
2 7588
> ps: excuse my english :o) I hope you have understand my problem.

and understood ;o)
Jul 17 '05 #2
You have to integrate your painting of the lines in with Swing's painting.
You could override paintComponent( Graphics g) (inherited from JComponent) on
the JFrame.
Don't forget to call super.paintComp onent(g)

"Jean-Philippe Martin" wrote:
Hi all,

It's my first post here, so you doubt I have a question :o)

I want to develop a mini graphical editor. Imagine that I have 2 JFrame, I
want to have one with a list of JToggleButton with a ImageIcon and one
called DrawingAeraWind with nothing into.

I would like to be able to draw the ImageIcon of the selected JToggleButton in the DrawingAeraWind if I click into this window. I would like to be able to drag and drop the drawn image in the DrawingAeraWind (just to change its position).

For now, I'm able to do this.

I want to add a functionality to my light editor. I want to add a
JToggleButton which didn't represent a ImageIcon to add in the
DrawingAeraWind but wich represent a link between 2 drawn Images. For
exemple, if I already have drawn 2 images in the DrawingAeraWind and that I select this new (link) JToggleButton, I want to be able to select the 2
drawn images in the DrawingAeraWind (by clicking on it) and to display a
line (graphic.drawli ne(image1, image2) )between these 2 images.

My problem is that my 'link' line is not visible, or is clipped, etc...

I use some JLabel to represent my drawn Image (to be able to do drag and
drop on it) and I use graphic.drawlin e() for the link line.
ps: excuse my english :o) I hope you have understand my problem.

Jul 17 '05 #3

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

Similar topics

1
9613
by: David Van D | last post by:
Hi there, A few weeks until I begin my journey towards a degree in Computer Science at Canterbury University in New Zealand, Anyway the course tutors are going to be teaching us JAVA wth bluej and I was wondering if anyone here would be able to give me some tips for young players such as myself, for learning the language. Is this the...
3
12517
by: Nuwang | last post by:
Hai, I'm using a swing to connect database with swing application... 1. How this swing connect with access database... 2. Important thing is how change Button size and Font size Still I couldn't manage my swing in proper layout pls run and check Code:
3
1985
by: pnolan | last post by:
Hello there, I'm brand new to Java and have. I'm taking my 2nd Java class at school and I'm pretty lost at this point. The main problem I'm having right now is I cannot get my code to execute. My code will compile, but when I try to execute it, either just using the "java" command or executing from TextPad, I get the following error: ...
0
3253
oll3i
by: oll3i | last post by:
package library.common; import java.sql.ResultSet; public interface LibraryInterface { public ResultSet getBookByAuthor(String author); public ResultSet getBookByName(String name);
1
2811
by: twin2003 | last post by:
need help with inventory part 5 here is what I have to do Modify the Inventory Program by adding a button to the GUI that allows the user to move to the first item, the previous item, the next item, and the last item in the inventory. If the first item is displayed and the user clicks on the Previous button, the last item should display. If the...
2
1718
by: carlos123 | last post by:
im pretty new to java. this might sound like a weird question but! how do i add this code class FileWrite { public static void main(String args) { try{ // Create file FileWriter fstream = new FileWriter("out.txt"); BufferedWriter out = new BufferedWriter(fstream); out.write("Hello Java");
1
2350
by: tommyny04 | last post by:
I'm kinda new to programming but I usually figure things out by myself but I need help with this. I'm trying to display an image in the Center region of a JFrame and other icons/button in the other regions. So far, I have this: public class RiskFrame extends JFrame implements ActionListener, MouseListener{ private BufferedImage bImage;...
2
8705
by: HaifaCarina | last post by:
i have this unfinished java program and i can't figure out what is the problem.. please help... /** * @(#)Answer3.java * * * @author * @version 1.00 2008/1/17
2
2509
by: pinkf24 | last post by:
I cannot figure out how to add the following: Modify the Inventory Program to include an Add button, a Delete button, and a Modify button on the GUI. These buttons should allow the user to perform the corresponding actions on the item name, the number of units in stock, and the price of each unit. An item added to the inventory should have an...
2
3743
by: yeshello54 | last post by:
so here is my problem...in a contact manager i am trying to complete i have ran into an error..we have lots of code because we have some from class which we can use...anyways i keep getting an error when i do the following. if you add a contact with up to 13 fields it will be stored in a data structure. i have a tabbed pane that will show six of...
0
7920
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7849
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8215
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8347
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7973
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8220
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6626
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
1454
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1189
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.