Event « JPanel « Java Swing Q&A





1. Image panel not repainted unless on system events    stackoverflow.com

A friend of mine asked me to help him with Swing, and I reached a point where I can't solve an issue. So, first I have an ImagePanel

public class ImagePanel extends ...

2. Respond to events in other JPanels    stackoverflow.com

Ok so lets say I have 3 Jpanels - 1 parent and 2 Children

//Assume necessary imports etc
parent is something like:
public class ParentPanel extends JFrame  {
private JPanel mainPanel,controlPanel;

public ParentPanel(){
   ...

3. Java: pass an event to another component    stackoverflow.com

Sorry I don't know if this is very clear, but I'm pretty new to Java. So I have a JFrame with a BorderLayout containing a JPanel and a JButton. What I want ...

4. Java: Handling event on component inside a seperate JPanel component    stackoverflow.com

So I have a JFrame which I've added a custom JPanel component. The JPanel component has a button that I want to attach a listener to in my JFrame. What is the best ...

5. How to have my JPanel appear when an action listneer is called    stackoverflow.com

I have a JPanel in another class and I want it to run when I click the "enter" button. For some reason it wont do that, I tried to write a ...

6. Accessing JFrame created in main from actionlistener    stackoverflow.com

I've created a frame (mainframe) for my program in the main class which I want to add and remove panels from in order switch between different screens of my program. ...

7. User defined event for JPanel    coderanch.com

8. JFrames and JPanels with ActionListeners    java-forums.org

I'm just writing some code for practice and have ran into some problems. I am brand new to JFrames and JPanels. Should I be using something else besides JPanels to create two grids of buttons? This code should just read the color of a JRadioButton and set the color of the JButton that is pressed to that color. My problems are: ...

9. how can i change an existing JPanel from a JFrame after an event happens?    forums.oracle.com

Good day! i'm new in java programing and im trying to build a GUI for a for a small inventory system. here's a part of my code............ if(e.getSource()==invButton){ if(username.equals(storekeeper)){ cont.add(new Equipment(cont,deck,username),"equipment"); deck.show(cont,"equipment"); cont.remove(this); }else{ cont.add(new EquipmentEmployee(cont,deck,username),"equipmentEmployee"); deck.show(cont,"equipmentEmployee"); cont.remove(this); } my code calls a new class called Equipment.java after a button is pressed and add it into a frame. but the problem ...





10. GUI, JFrame, JPanel, ActionListener, simple multi-class applications    forums.oracle.com

My assignment calls for: "Create a Frame class" "Create a Panel class which implements ActionListener. Add JLabels, JTextFields, JButtons to the panel" most of this is pretty straight forward right out of GUI examples from my textbook but I don't have much experience with running multi-class programs, and this one is a bit more complicated b.c we have to use implement ...

11. Events in JPanel    forums.oracle.com

The problem is if you add a component on top of the JPanel, that component will now trap the mouse events and will not propagate them to its parent (the JPanel). So you need to addMouseListener on the component so it will pass the events correctly to your listener class. Edited by: imperio59 on Oct 12, 2009 5:49 PM

12. Event Handling between JPanels    forums.oracle.com

I find what helps is to rethink event handling. Example: suppose you have a buttonX on panelY that causes a change in panelZ. Old way of thinking: code for class PanelY has an ActionListener that is notified when buttonX is clicked. It reacts by calling some method of class PanelZ. This requires PanelY to know about PanelZ. New way of thinking: ...