swing

Drawing A Piano

Hello Everyone, I have started working on a software synthesizer (or keyboard). I have decided to use Java because of the available Jfugue API. I am trying to figure out how to go about creating the actual keys (notes) of the keyboard user interface, but I am stuck. I have tried to create an interface by dragging/dropping black and wh...

tabs problem in Java Swing

I have created 8 tabs in a tabbed panel using Java Swing. The problem is when I enter data in any tab and click the save button. After clicking it leaves the present tab/panel and goes to the first tab. I have to retain on the same tab after clicking the save button. Please help me on this. ...

loading a file and getting its contents crashes on me.

private class Lytterklasse implements ActionListener{ public void actionPerformed(ActionEvent e) { JFileChooser chooser = new JFileChooser(); FileNameExtensionFilter filter = new FileNameExtensionFilter( "Sudoku Tekstfiler", "txt"); chooser.setFileFilter(filter); int returnVal = chooser.showOpenDialog(getPar...

How to represent double values as circles in a 2d matrix in java

Hello, so I want to write a matrix explorer which enables me to reorder rows and columns of a matrix. For this porpouse I used the Jtable class. Now the problem that I have is that it is very difficult to reorder a matrix by looking at double values, so I would like to print the matrix not with the double values but with circles in whic...

swing gui improving

hi all , i am looking for some methods to improve swing gui for example i want to know about new components libraries , new methods to enhance swing performance , new methods to add special effect to swing gui and new plaf for swing . please i want to know how to use this topics and where to find some tutorials about it . thanks. ...

Java layout ignored properties documentation

Is there a table documenting which properties each java layout ignores (max size, min size, etc)? ...

Problem with Java FX Look and Feel

Hi, I was looking at some of the examples from the Deitel and Deitel's book for Programming in Java, and one of the first examples is a very simple Swing display. Hence this snippet of code : import javax.swing.*; public class cdea { public static void main(String args[]){ JOptionPane.showMessageDial...

"Zoom" text to be as big as possible within constraints/box

First problem: You have 400 pixels width to go on, and need to fit some text within that constraint as large as possible (thus, the text shall use that amount of space). Throw in a new constraint: If the text is just "A", then it shall not zoom this above 100 pixels height (or some specific font size). Then, a final situation: Linebrea...

Swing based 2D graphics library for Text

Is there a library that would give me 2D graphics with a focus on Text for Swing. I am building a simple form designer and need to position text correctly on a 2D display. It would be nice if there was a library that handled the newlines and possibly editing. ...

How can I set partial text color in JTextArea?

I want to set color for specific lines in the text area. What I've found so far, is the following // Declarations private final DefaultStyledDocument document; private final MutableAttributeSet homeAttributeSet; private final MutableAttributeSet awayAttributeSet; // Usage in the form constructor jTextAreaLog.setDocument(document); hom...

Java2d: Option to show a selection window when mouse is dragged.

Hi, I have a image in Java2d and I would like user to give an option to select any rectangle portion of the image by left clicking and dragging the mouse.(similar to mspaint). How is this actually done? Thank you. ...

Java2d: Increase the line width

Hi, I want to increase the Line2D width. I could not find any method to do that. Do I need to actually make a small rectangle for this purpose? Thank you. ...

Access tree object in netbeans outline

I'm using Outline from netbeans to display some structured data. How can I map selected row to an object in tree? ...

Java2d: Set gradient for a lines

Hi, I am having multiple points in a plane and some hundreds of lines pass through those points. Some points can have more lines passing through them than other points. I want to show some kind of more gradient or brightness associated with lines crowded together. Is this possible to do in java2d. Please refer to this : http://ft.ornl....

login form with java/sqlite

hi I would like to create a login form for my application with the possibility to add or remove users for an sqlite database, i have created the table users(nam, pass) but i can't unclud it in my login form, it someone could help me this is my login code: import java.awt.*; import java.awt.event.*; import javax.swing.*; public cl...

Is it Possible to show a previously hidden JFrame using a keylistener

here is my code, i basically just did a tester for the most common listeners, which i might later use in future projects, the main problem is in the keylistener at the bottom, i am trying to re-show the frame but i think it just cant be done that way, please help ps: no idea why the imports dont show up right. package newpackage; impor...

JToolbar is hidden by JMenu

I'm using Netbeans to add a JToolbar to my window which also has a JMenuBar. Here is the design-time look: .. but during run-time I get this: With the toolbar seemingly partially hidden under the menu names. This is on the Mac, btw. Is there something stupid I've forgotten to do or some layout trick I should be using? EDIT: I'll ad...

Java: Help constructing a fillTextFields() method

I have a Java project where I am to connect to a database and create buttons (next, new, save, delete, previous) to navigate through the database content where there are appropriate text fields and labels for the specific information. I'll use the code below as an example (each button is set up very similar)... I have it as follows: JB...

Double Buffering with awt

Is double buffering (in java) possible with awt? Currently, I'm aware that swing should not be used with awt, so I can't use BufferStrategy and whatnot (I already have some code written in awt that I don't want to rewrite in swing). If double buffering is possible with awt, do I have to write the buffer by hand? Unlike swing, awt doesn'...

add database Tablenames to the JList in java

// Declare JList private JList jlstTab, jlstCol; . . . DefaultListModel dlmTables = new DefaultListModel(); DefaultListModel dlmCol = new DefaultListModel(); // Instantiate dlmTables.addElement("kl"); jlstTab= new JList(dlmTables); jlstTab.setSelectedIndex(0); jlstTab.setSelectionMode(ListSelectionM...