swing

Why is my JFrame not showing?

I'm pretty sure I've done it this way before, but for some reason, the JFrame won't show up when I run it. JLabel originalString = new JLabel("Original String: " + str.getMutator()); JLabel currentString = new JLabel("Current String: " + str.getMuta...

swing component in pyqt

Is there a way to run a swing component through a pyqt widget? I'd like to write a small project using pyqt, but there's a java library that draws to a JPanel-inherited panel, and it would be really convenient to be able to embed one into the other. I know I could use jython and qtjambi, but I was curious if there was an alternative su...

JCombobox adding different color to each item

Hi, I have a doubt on Jcombobox... for example, i have a gui which contains a jcombo box and a button... In Jcombo box ,i have added string array object like color 1,color 2 ,color 3: String[] colors = {"Color 1","Color 2","Color 3"}.and i can select color when clicked the button by using of colorchooser and it will apply into the bu...

how to handle focus lost and focus gain event using "shift + tab" and "tab"?

I want the ability to gain the focus on the next focusable component on clicking tab and to get the focus back on the previous component on shift + tab. So need a help on how to achieve the same. thanks ...

valueChanged in ListSelectionListener not working

I have created the following class implementing a ListSelectionListener interface. This class should "listen" to the selection events of a JList I have created. Everytime the use clicks on a row of this list, the selected_row value should be updated and the string "The format row selected is ...." should therefore change. However after c...

draw image or draw filled circle?

We have an old Java Swing application. we need to display thousands, hundreds of thousands small circle spots on the canvas based on the real data. Right now we have an image file of a small circle spot. When we need it, we draw that image onto the canvas, thousands, hundreds of thousands times. Now I am think it may be better (better p...

SWT Composite needs pack() in 3.6.1

My wizard isn't rendering correctly in Eclipse 3.6.1. It's leading me to wonder: when does one have to use Composite.pack()? Some SWT examples have it, and some don't. How my wizard pages renders depends on the target platform. If I run my plugins in 3.5.2, they render correctly as soon as I open them. But in 3.6.1, their contents areas...

Swing components naming convention?

Is there any naming convention for swing components such JButtons..? or does any body knows any good way for doing that? Thanks ...

java boxlayout composition

I haven't understood this since I had started working with Swing. Why BoxLayout with Y-Axis sorting places (from the example) buttons one under another with space all the way to the end of panel (that's what I thought how it works) but placing JPanels same way but making them stretch. Would someone be so kind to explain to me the phenome...

Passing events to parent

Hi, I'd like to create an app where some events are supposed to be handled as if they were delivered to parent containers. For example I've got a JPanel which contains JLabel. The top JPanel implements mousepress and dragging right now. What do I need to do, in order to make the events look like they arrived to JPanel instead of the labe...

how to exit upper frame by click on ok and how to add back button when two page in single frame

import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.sql.*; public class Prhr extends JFrame implements ActionListener,ItemListener { JLabel l1; JLabel l2; JTextField ar; JTextField t; JButton b1; JButton b2; JButton b3,b4; JComboBox c1,c2; JLabel l3; Connection con; S...

java 2D drawing

hi , im trying to make a swing app that draws a function's graph(simple for now ex. x+2) but i'm having problems to make mathematical coordinates of my points depending on screen coordinates . I want it to simply draw a line that goes from P1(0,1) to P2(1,2) inside my graph. here is my code : import java.awt.*; import javax.swing.*...

Trying to wrap JLabels to JPanel inside JScrollPane

EDIT: As in the example (now written by me) what I'm trying to achieve is packing JLabel (+JTextFields, not in the example) into JPanel with FlowLayout and sorting these panels with BoxLayout one under another but limitting it with JScrollPane so I can specify how high the view area is and if those JPanels (packed JLabels) exceed the hei...

What's the omission/error out here?

There should be an error/omission in the next code but I can't see where mostly because I've never used threads. Can someone please find what I'm missing? import java.awt.BorderLayout; import java.awt.Button; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Timer; import java.util.TimerTask; imp...

Swing Application Analyzer

I believe an application exists that lets you visually analyze your swing application, I've used it before but I can't remember the name. From what I remember, you launch your app from within this analyzer and you can hover over any component and the analyzer will tell you the properties of the component, such as the type, name of the h...

JColorChooser and JFileChooser open problem

I want to show the dialogs JColorChooser and JFileChooser programmatically from a method called when I submit a buttons. After the button is clicked the method is invoked but the dialogs won't display. I have a JFrame with a null layout (absolute positioning) and, e.g., the following code: public class _TEST_ extends JFrame { priv...

How to set "columnWeights" and "rowWeights" for a GridBagLayout in NetBeans?

Apologies if I'm missing something silly... but I'm experimenting with NetBean's WYSIWYG Swing GUI builder, and am having some issues with GridBagLayout. When writing a Swing application from scratch, I'll typically establish the column and row weights in one fell swoop at the time I first declare the layout. Something like this: fina...

Java: Jswing: Jlist

When i input a name to the Jlist, the name gets outputted to the lower section of the list, how do i make it to where the name is set to the top of the window package Gui; //import java.awt.BorderLayout; import java.awt.BorderLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.*; public...

jchart2d for displaying dynamic charts with fast updating data

I want to use jcharts2d to plot fast updating data. The examples for dynamic charts in their webpage use a dummy random function to simulate fast changing data, any ideas on how to feed data into the chart? thanks in advance ...

Adjustable Panels In a Display using Java Swing

I have an application that uses Swing. The display I am working on, uses a Box with a Horizontal Layout as the top container. In it, are three other boxes (which actually contain the content). The appearance to the user is a window with three panes, arranged horizontally across the screen. What I want to do is give the user the ...