I'm using an ActionListener to update a JList whenever an item is selected.
jComboBox.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JComboBox cb = (JComboBox) e.getSource();
updateLocalFileList( cb.getSelectedItem().toString() );
}
});
It is calling this method for the UI...
Hello all, I am trying to get my options straight with some inputs that I want to enter in an application I am developing.
I want the user to input a list(of Strings) of which the size will be his decision.
I have thought of some crude solutions, like going with JOptionPane until user enters a specific input, but I would like a soluti...
Hello all, I am trying to make a JOptionPane get an input and assign it to an int but I am getting some problems with the variable types.
I am trying something like this:
Int ans = (Integer) JOptionPane.showInputDialog(frame,
"Text",
JOptionPane.INFORMATION_MESSAGE,
null,
null,
...
First off, I am real new to Java Swing/AWT and not intricately familiar with the workings of JFrame, JPanel & JButton. I want to just display a simple PopUp dialog with a some text and a couple JButtons and it should exit when any of the two buttons are clicked. I have most of that logic in this class, however I'm still struggling to mak...
I am a newbie at Java Swing/AWT and I have this code following working for a simple PopUp dialog which closes on any of the JButtons beind clicked, but displays real wonky. Does anybody have suggestions on what and how to fix?
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Font;
import java....
I am using Java Swing to create a JDialog, and i am trying to create a Show/Hide details button to show/hide a report at the bottom of this JDialog.
It works fine for me, but i want to do this with time, to add a small animation effect while showing/hiding the report, i have used TimerTask but it's just showing the report directly witho...
Hi
I create jFrame and put some components on it .
I put Jpanel on it also in the left side of JFram
when I change the size of the JFrame , the location of panel (Accourding Left Side of the JFram ) changed ...
How can I keep the same space between the panel and the left edge of JFrame
Is there Layout benefits me ??
mabey this ima...
Hi,
I am using a JTabbedPane in my application. I have added two tabs which are instances of a custom class "ContentPanel". This extends JPanel and sets the background, border etc etc. Basically it means I dont have to set the properties of each JPanel I want to apply this colour scheme to. I notice that not only does their border appea...
i am buiding a small jframe with 2 lables and 2 textfields(Jtextfield1,Jtextfield2) and a jbutton
.i want that when the user enters some data in the Jtextfield1,the data is retrieved from database regarding user and his details are displayed in the Jtextfield2.
i know how to retrieve data from database but how to apply actionperformed to...
I am using the code below to display the records from my database in the swing form. However, when I click on the button it only shows the first record of the database (table in database has 5 records)
private void btnnextActionPerformed(java.awt.event.ActionEvent evt) {
try
{
...
Hello all,
I have a problem with a part of a project i am working on. I want to display some emoticons using Java Swing, however it won't allow me to display consecutive identical styles:
This works fine: Smile Sad Grin
This doesn't work: Smile Smile Smile
I am using Styled Document and have little experience with it. The code is as...
My program generates results concurrently. I want to append each result, as soon as it enters the swing-thread, to a pane which shall render the result's html-fragment like:
<ol class="result-type-a"><li class="foo-result"><html-output-of-result .../></li></ol>
Is the JTextPane the right component?
Are there problems with my "streami...
Hello everyone, I am trying to make a JFrame appear on mousePressed Location but I keep failing and it get's annoying :( Any ideas what isn't working?
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event...
Hi ..
When I am using GridBagLayout , whenever the window is resized the component locations change to the fit new size ..
Now I want to change the location of a component after an event ( like a mouse click on any button ) until the component goes out of the window (it's like the properties or toolbox window in Visual Studio 2008) , I...
I know this is kind of a beginners question but my books aren't explaining it and the API isn't helping much when I don't understand it. Someone please help me to get this.
I created a JList using NetBeans and everything is set to whatever NetBeans has as a default for JLists.
My goal is to make a JList show a List of [x] if a user pic...
Take the following example code. There is some bug in Swing which doesn't render disabled components as disabled if the component contains HTML. Aside from reporting the issue, which I hope a colleague has already taken care of, is there some good way to work around the problem?
Whatever solution I take, I want it to be a global fix a...
I have two tables. One table is a fixed column(ie. the table will not have any impact on the scrolling of scrollbar of another table). These two tables have to be commonly scrolled by a vertical scrollbar.Any idea or suggesstion or examples?
This is a continuation of the previous question.
Fixed Column
The answer for which is here Fixed...
Hello everyone, I am not sure if I have set the right title for this post - so it is possible that there's already a post for what I am looking for, if that's the case feel free to close this and redirect me - what I am trying to do is this:
When a JFrame is poped the user not to be able to click anywhere else in the gui unless that win...
I have created a custom JButton class for representing spaces on a monopoly board. The game is multiplayer so a lot of the information needed to draw the button is held on the server (accessed via RMI).
My problem is that when I mouse over the button it automatically seems to call repaint() (and draws a border). This makes the program ...
I have a custom component subclassed from JPanel, with a keyboard handler. My main application embeds this inside another JPanel. Now I want the parent JPanel to also respond to keystrokes, since there are some actions that need to be taken only when the component is focused, but which apply to the app as a whole, and not that component...