I'm writing a Java application with movable frames, and I've come across a quirk in Linux. I'm running GNOME 2.16.0 under CentOS.
When I use JFrame.setBounds to set the bounds to any location that's half off the screen, it actually sets the location of the frame to be as close as possible to the bounds specified while still staying com...
Hi, I want to create a list of GridBagPanel.Constraints.
I read it in the scala programming book, that there is a cool for-yield construction, but I probably haven't understood the way it works correctly, because my code doesn't compile. Here it is:
val d = for {
i <- 0 until 4
j <- 0 until 4
} yi...
Hello,
I show() a JPopupMenu based on what the user types in a JTextField, however, when that happens the user typing on the keyboard will no longer write into the text field, unless with the mouse clicks again on the field, thus closing the popup menu.
I want, like in Eclipse and NetBeans code completion feature, that the user may sti...
I have a JPanel with a Grid Layout. In the "cells" of the grid I can put different elements (for example JButtons). There is no problems with that. But now I want to put a filled circle in some of the cells. I also would like to relate an ActionListener with these circles. In more details, if I click the circle it disappears from the cur...
I am looking for a way to ensure that my text field (JTextField, JFormattedTextField) is returning a double or int rather than a string when I call .getText(). What is the best way to do this (if possible)?
Thanks!
badPanda :D
...
When I set the GridLayout to the JPanel and then add something, it is added subsequently in the "text order" (from left to right, from top to bottom). But I want to add an element to a specific cell (in the i-th row in the j-th column). Is it possible?
...
I have only JTabbedPane inside JFrame. JTabbedPane sets its dimensions to biggest page width/height.
As pages has different size is it possible to force JTabbedPane to change its dimensions when selecting other page?
http://grab.by/3hIg
Top one is how it behave now and bottom one is how i want it to behave (i resized frame by hand)
...
Recently I asked which was the best Swing component to bind to a BigDecimal variable (with some particular editing properties). It turns out that none of the standard Swing components suit me completely, nor did the third-party Swing component libraries I've found out there. So I’ve decided to create my own Swing component.
Component de...
Hi, I'm trying to create link-like label in scala. But no mouse events works for me. How are they supposed to work?
class Hyperlink extends Label{
text = "hyperlink"
reactions += {
case MouseClicked(_,_,_,_,_) =>
println("mouse clicked")}}
I put this in some panel and click over the label like a pro minesweeper player... a...
Is there a way to tell a JTable's row filter that it should update itself to display the filtered data? I'm currently using the fireTableDataChanged method in the AbstractTableModel but the underlying data for the table isn't actually changing, so this seems like it might be wasteful. The way my filter works is to check if data in the ta...
This may be a silly question I don't know.
Is there a way to remove the highlighter to represent focus in a Java GUI?
For example when you click on a button the text will have a slight rectangle around the text.
Thank you
...
package test;
import java.awt.*;
import java.awt.event.*;
import java.awt.geom.Ellipse2D;
import java.awt.image.BufferedImage;
import javax.swing.*;
public class test_bmp extends JPanel implements MouseListener,MouseMotionListener,ActionListener
{
static BufferedImage image;
Color color;
Point start=new Point();
Point end =new Poi...
I need to load database content into a JTable. Many times I search for help. Please anybody can refer a tutorial please, otherwise anybody can help me to do so.
...
Hey,
I have a simple Jlabel element with text and icon
setting the background changes the full label colour.
I want to be able to only render the background colour on the text section of the label, ie - to have separate backgrounds/foregrounds for the icon and text. Selecting/deselecting the label will flip the colour behind the ic...
i want to add images or labels with image in it to a panel at any location which will be decided by the user clicking on the panel(add image where user clicks in the panel).
how to do this.
thanks
...
I'm writing a Java TextComponent where the underlying document has some structure. It is very short, basically one line. I need to be able to override the response to inserting or deleting characters in some parts of the document.
My initial approach was to implement javax.swing.text.Document, but this seems to involve developing many a...
In our product, we have frames that are basically three inheritance levels down from what is essentially a JDialog. This frame overrides the default pack() method as shown:
@Override
public void pack() {
this.setSize(getMaximumSize());
validate();
super.pack();
}
@Override
public Dimension getMaximumSize(){
return supe...
I am creating a container of JComponents which will look like a piano keyboard. The black keys look like this (Groovy)
def setBlackNotes(buttons) {
def octaves = (int)(buttons.size() / 5)
def gridLayout = new GridLayout(1, octaves*7);
def blackNotePanel = new JPanel(gridLayout)
this.add blackNotePanel
def i = 0
...
Hi is it possible to place an icon in the title of a titledBorder for example the following code:
import java.awt.GridLayout;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.border.TitledBorder;
public class TitledExample extends JPanel {
public TitledExample() {
super(true);
...
First, i'm new at Java-programming and my native lang is not english, but still i hope to get some help from you all. What I try to do is a simple java-interface with a jComboBox and a jList. I want to poplate to jComboBox with Object-names and when the user select one of the names get the object-id which i will use to populate the jList...