swing

What JEditorPane event should I create a listener for?

Suppose I have a JEditorPane in a JPanel. I want to be able to execute a callback each time the user enters/pastes text in the JEditorPane component. What type of listener should I create? ...

Undecorate JInternalFrame on MacOS

I am trying to undecorate a JInternalFrame, i.e. remove the default titlebar using the following code; BasicInternalFrameUI ui = (BasicInternalFrameUI)internalFrame.getUI(); ui.getNorthPane().setPrefrredSize(new Dimension(0,0)); I works on windows but the second line throws a NullPointerException on MacOS Any ideas why and how to get...

How resource intensive are Listeners in java?

Hello, I'm new to Java Programming but an experienced C++ programmer. I was learning how to program GUIs using swing. I was wondering how resource intensive (runtime as well as memory) are ActionListeners? Is there a general guideline to the total number of listeners that one should create in a particular program? How many until perfo...

jCombobox JPA HQL inner join error.

Hi everyone , i am new at Java , i got a problem like this ; i have got a desktop application , there is 2 jComboBox in JFrame.One of this jComboBox is hold Personels from Personel Table and another is take Personel's title.When jComboBox1's selected index changes occurs it will get personelid and fill jComboBox2 with its title.Thats ...

I'm writing a screen capture module in Java, but I'm having serious performance issues writing screenshots to disk. What else can I do?

I'm writing a screen capture module using the Robot class. I'm taking screenshots of the application every x milliseconds and writing them to disk. After screen capture is finished, I'm compiling the screenshots to video with FFMPEG. However, writing images to disk is extremely slow and grinds my application to a halt. What am I missing...

How to "do something" on Swing component resizing?

I've a class which extends JPanel. I overwrote protected void paintComponent(Graphics g). There is a variable which has to be recalculated when the panel's dimensions change. How do I do that in a proper way? Thanks in advance ...

Swing: How could I use JTree with JTextPanes as nodes?

JTree uses DefaultTreeCellRenderer as cell renderer. This class is a subclass of JLabel. I want to use JTree with more complex elements than JLabel, such as JTextPane. Problem is: I can't subclass DefaultTreeCellRenderer, because it would still be a JLabel. Writing an own TreeCellRenderer is too complex. Why? Because: DefaultTreeCell...

Is there a JToolBar replacement that offers more functionality?

I'm creating a simple Swing application, then I realized that JToolBar doesn't provide much functionality. For example, I want to add multiple dragable toolbars onto one JFrame, but but I can only have one floatable JToolBar per JFrame if I use JToolbar. I know that NetBeans is built with Swing, and the toolbars on NetBeans have more fu...

Java Server application architecture with Swing thin client

I am currently looking to set up a client/server application. I am planning on having the clients written as a Swing thin client. I am not really sure how I should set up the Server side application. The Java Server side application would have the application business logic, database access, etc. I see a lot information on the web abo...

Newline in JLabel

How can I display a newline in JLabel? For example, if I wanted: Hello World! blahblahblah This is what I have right now: JLabel l = new JLabel("Hello World!\nblahblahblah", SwingConstants.CENTER); This is what is displayed: Hello World!blahblahblah Forgive me if this is a dumb question, I'm just learning some Swing b...

How to transfer objects from Jframe to another Jframe ?

Hi all, I have two JFrames in my application. In the first JFrame there is a JTable. When the user clicks the JTable I want to get the clicked row's object then open the second JFrame and fill its data fields with this object's elements. So how can I transfer objects between JFrames? Can someone give me an example for this? ...

How to make the background of a JCheckBox transparent?

Is there an easy way to make the background of a JCheckBox transparent? The box itself and the text should both be ordinary colored. Thanks in advance ...

Java Timing Framework - triggering event at the end of an Animator animation

I'm using the Animator class from the Timing Framework to perform a simple animation (moving a JPanel), roughly based on examples in Filthy Rich Clients I've overridden timingEvent() as follows public void timingEvent(float arg0) { float fraction = this.animator.getTimingFraction(); fraction = Math.min(1.0f, fraction); if...

Why does the JFrame in this code react to ActionEvents when only the button object has the .addActionListener?

The button in the code below is to me the only object that should listen for ActionEvents but when I resize the window the circle changes color which should only happen when the button is pressed. Does it in some way use frame.repaint() when resizing the window that generates new values for the drawPanel object or even makes a new draw...

Java Swing revalidate() vs repaint()

I'm putting together a Swing application where I often want to replace the contents of a JPanel. To do this, I'm calling removeall(), then adding my new content, then calling revalidate(). However I'm finding that the old content is still actually visible (though obscured by the the new content). If I add a call to repaint() in addition...

AutoIt for Java

I need to automate UI testing of a software that my module is plugged in. I do not have an access to code of the host so I need something like AutoIt. Since AutoIt does not work with Swing, is there any AutoIt like GUI automation tool for JAVA based applications? ...

Returning A Value To a Swing Class from another Swing Class

Hi everyone. Some background on myself. Former AS/400 guy, recently downsized and unemployed. Taking this opportunity to learn java. I’m fairly new to Java and Netbeans. Since I’m unemployed and not in an organization with ‘experts’, I’m trying to find resources for help. I’m in ATLanta so I’ve joined www.ajug.org in hopes of networkin...

Why is JFrame layout not the one I set?

If I set a layout on a JFrame with setLayout and then retrieve it with getLayout then I get a different LayoutManager. What is going on here?? public class Lay { public static void main(String[] args) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { java.awt.Container contain...

'Loading circle' or 'busy label' for Swing?

I've used this 'LoadingCircle' project in .net applications. Is there an equivalent component that provides a loading circle for Swing? Are there any other loading indicators available for Swing. ...

Can I set the DPI resolution of my Java Swing application without changing the systems' DPI setting?

I have a Java application using the Substance LookAndFeel with Windows as the the target platform and I want to increase the DPI setting of my application without changing the system setting. I want to do this because I don't want to force the user to restart Windows and because many Windows applications seem to have problems with very ...