Swing - progress bar

Gentlemen, I have been trying for a long time to figure out how to get the program bar to work, but I didn’t have anything. The situation is this - a large array of objects is processed, it is clear that in the for-loop. There is a progress bar on the JFrame. The code looks like this:  SwingUtilities.invokeLater(new Runnable(){ @Override public void run(){ for(Geoobject geoobject:Geoobjects){ //здесь нужно поменять значение прогрессбара //Какие-то действия с ... Read more

Display selected text on swing

I use the JTextPane class. It is necessary when working in any other component to highlight the selected text JTextPane without transferring the focus. By default, the selected text is highlighted only if the JTextPane has received focus. Variants of playing with JTextPane styles are not to be offered - they are used in an honest way, and you really don't want to do hack where there is clearly a better solution. What can be done in such a case? Read more

How to change the theme in any java application?

Hello! I'm in Java a complete layman, just a user. But I want to figure out once and for all: how to change and customize the themes in Java applications? And is it possible to do this if the Java application itself doesn’t work with themes? For example, I use the NetBeans IDE. It can only customize the appearance of the code editing area. And you cannot customize the entire NetBeans design theme - the color of frames, lines in trees, fonts - is impossible And I, for example, need to cha... Read more

A translucent java window that ignores mouse clicks

The task was to create an application one of the components of which is a translucent window that is always on the front plane, while behaving as if it is not there. Ie if there is an application behind this horse, then only this application will respond to mouse clicks. Is it possible to do this with java? The only question is to ignore clicks. Read more

Что использовать для Java GUI приложения?

Необходимо создать приложение на Java, GUI для десктопа(что бы запускалось на Windows/Linux). Цель — самообучение. Какой фреймворк лучше учить AWT или Swing? Или предлагайте свой вариант. Использую Java 7, NetBeans. Read more

Now NetBeans Will Not Have a Swing Visual Designer?

Version 7.1 does not want to open my project from the old version in the visual form designer, saying "Use version 7.0 to work with the Swing library." Have to use 7.0? Or are there ways to solve the problem? Read more

How to update the data in the JTable correctly after changing it in the source?

I have a program. Some data set is stored in an ArrayList object. I inherited the model of the AbstractTableModel table and used it to transfer data to the table. The model receives a reference to an ArrayList object. How after adding data to an ArrayList object correctly update the table? And then you have to hang in the interface everywhere myTable.updateUI (). Read more

How to display pictures in javax.swing.JTable cells?

In general, there is a table in which the text is currently displayed. I need to display pictures from the file. Now: public class MyModel extends AbstractTableModel { private char[][] level = new char[10][20]; .... public Object getValueAt(int r, int c) { return this.level[r][c]; } .... } How can I edit getValueAt to display images? Read more

How to fix a bug when working with multiple windows? Java Swing?

In general, there is an application written using MVC. Sketched a simple example (bug available) how it works. I am just starting to learn Java, but never worked with MVC at all. In general, it turns out that after several switching between windows, the menu items all accumulate, and accumulate ... I think this is not the only joint, but immediately noticeable - just this one. And in general, I would be glad if someone explained how to do the correct switching of windows in my case, becaus... Read more

What is the reason KeyListener does not respond to keystrokes? Java Swing

Strange bug temporary. That is, it is, it is not. Then everything works OK, then after a couple of restarts, the window stops responding to keystrokes. At the same time, isFocusable == true, elements JMenuBar are available, work. But the window doesn’t react to any keystrokes.  isFocused and isActive also true Read more

Useful Links