swing

Layout manager won't work

Hi, I have done an layout in my GUI but it did not work , all the component just appear one after another. Here is my codes : import javax.swing.*; public class main extends JFrame { public main() { try { add(new FYP_Tx.GUI()); setDefaultCloseOperation(EXIT_ON_CLOSE); setSize(800, 600); setLocat...

java swing- escape key event causes classCastException in look and feel

Good morning everyone! I need your help! My application processes patient records. In the main frame user can open several internal frames. Each internal frame contains a tabbed pane and each tab created by the user contains a form where he can enter patient's data and a jtable where all added patients are shown. When the user clicks ...

GUI Problem!Network Problem!

Hi, I have two applications,one is for server and the other is for client.at first I run my server application .then I will run the client application.When you run the client application,one frame will be shown which get user name and password and if they were correct,the other frame will be shown.but when I click on the Sign In button ,...

Java Swing: Extend DefaultComboBoxModel and override methods

I am using the DefaultComboBoxModel to display a list of customers in a ComboBox. The list currently displays their name only. I would also like to have a reference to each customer within the DefaultComboBoxModel so that when a name is selected, it also holds the reference to the real customer object. To achieve this, I suspect I have ...

How to remember last values in a Swing GUI form?

Hello. I have a simple Java GUI form made with Swing. It has some text inputs and checkboxes and I want it to remember the last values input to these. Of course it is possible to save them to some file manually and then read the file and fill the inputs, but I wonder if there's a way to do this more or less automatically. Thanks ...

jframe component layout

How can I specify the location on JFrame that a component (JLabel specifically) is placed? I created a JFrame object and added a JLabel and a JList to the frame but both objects are being placed on top of each other. I have tried using label.setBounds(10,10,10,10); list.setBounds(20,20,100,100); and label.setLocation(10,10); list...

Do I have to learn AWT before learning Swing?

If I want to code an desktop application in Windows with Java, should I buy a book about Swing and just skip reading books/tutorials about AWT? Or do I have to learn AWT before using Swing? ...

Java automatically adjusting to the Windows 7 font size adjustment

In Windows 7, if you change the font size via the Control Panel->Appearance and Personalization -> Display "Make text and other items larger or smaller", it adjusts not only the menu sizes, but also the text content size of apps like Notepad, Wordpad, Firefox. Is there a way to get Java to automatically scale the font without having to...

How can I update my JList without running that frame again?

I have a main frame that has a list and "add" button. When I click on the 'add' button, one frame will be shown that I can enter name, family and id. And by clicking on the "addAPerson", the name will be stored in the SQL. But when I close the frame, the new person will not be added to my list which is in my main frame but if I close th...

Change JScrollBar arrow height

Hi, How do you change the height of the arrows in JScroll Bar? I was able to change the width of the Scrollbar but the height of arrows were still small. Thanks for your help. ...

Java Swing event

Hello, I wonder how one should implement an event which will do some Action when a button is pressed, and stop do that action when button is released I tried to add MouseListerner for this approach. The problem is it will recognize that I have pressed the button. But not which button it is. So wonder how should it be written so it will ...

undo, redo, delete function in java

hi there, I need to write these 3 functions, but i got stuck at redo and delete. Redo is showing error when there is nothing to redo and i don't know how to write delete function. Thank you undo public class Undo extends AbstractAction { private MyCanvas myCanvas; public Undo(MyCanvas myCanvas) { this.myCanvas = myCanvas; thi...

JTree Multiple Node Renderer problem

In the following JTreeBasics.java file, is it possible to have different images for BlackBox and WhiteBox nodes? import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; import javax.swing.tree.*; import java.lang.reflect.*; public class JTreeBasics{ JFrame f; DefaultMutableTreeNode root,n1,...

MigLayout usage

A question for those familiar with MigLayout sorry couldn't think of a more appropriate name for the question... I'm trying to create a layout that will end up looking like the following: +---------+---------+ | btn1 | btn2 | +---------+---------+ | | | btn3 | | | +---------------...

show Jframe but not show title bar on task bar

In my application, I show a Jframe at the corner of screen for notification. And I want to show only Jframe and do not display a title bar at task bar. How can I do that? ...

Java Swing Scrollpane in NetBeans

I have Java application which adds JTextFields @ runtime to JPanel. Basically user clicks a button and new JTextField is added, clicks again added again... Each new JTextField is directly below the previous one. Obviously I run out of space pretty soon so I'm trying to use JScrollPane and thats where the hell begins, because it just do...

Best way to add a String in a JFrame

which is the best way to add formated string in jframe. Previously I was trying to add jlabel ...

how to upadte string of jlabel in particular interval

as i change string but it remain as it is in jlable. i want to update that string from particular timeperiod ...

Looking for a feedback on JIDE

I'm about to start development of fairly large java based desktop application. After looking at JIDE components and frameworks, it seems to be a good solution at a glance. I'd like to hear from those who used those products. How reliable are they? What's the learning curve? Pros and cons? ...

Swing problem!(problem in showing a frame)

Hi, sorry for posting a lot of code!!I don't know that why my ListFrame doesn't work??? these are the classes.At first I run the MainServer and then I will run the MainFrame in the other package.and then by inserting a correct user name and password ,the Listframe will be shown,BUT I click on menu bar or list or delete button but nothing...