I'm trying to print Invoices in a Java Swing applications. I do that by extending Printable and implement the method public int print(Graphics g, PageFormat pf, int page).
I would like to draw strings in columns, and when the string is to long I want to clip it and let it end with "...". How can I measure the string and clip it at the r...
Hey Guys
I want to add menu like office 2007 which can be done by flamingo-substance?
I don't find any proper documentation or good example.
So how to use flamingo in my application?
thanks in advance.
...
when i run my application i get the following error:
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at javax.swing.text.FlowView$FlowStrategy.layoutRow(FlowView.java:546)
at javax.swing.text.FlowView$FlowStrategy.layout(FlowView.java:460)
at javax.swing.text.FlowView.layout(FlowView.java:184)
at ja...
I have a longer text saved in a String. I would like to print the text in two columns on a single page. How can I do this using Java Swing?
I don't understand how I can wrap the text when it's time to use a new line. I have read Lesson: Printing in the Java tutorial, but I haven't found any useful methods for working with text or String...
How can I associate my model class with entire row in JTable in order to get link to model class by row number?
...
I understood that every top level container has some layers:
root pane
layer pane
content pane
glass pane
but I didn't understand if the root pane is the top level container itself...
which is the equivalence between a pane and a container? In fact when I return a pane with
getContentPane() the object is a Container type!
...
Hi,
I got a JScrollPane in which I want to place a list of radio buttons and labels. My problem is the panel doesn't scroll, I suppose it's because i didn't set a viewport, but how can I set it when I have to many components?
My code looks something like this:
JScrollPane panel = new JScrollPane();
JRadioButton myRadio;
JLabel myLabel;...
I am creating a JButton which includes a specific ImageIcon. The main issue is that the original icon size is much bigger than the button size. As result when the button is displayed, only part of the icon can be seen. What is the method that "resize" an ImageIcon i n order to make it fit inside a JButton?
...
Hi
I have a java panel with 4 buttons. When I click on of these buttons, a new frame appears and the first is hidden with setVisibile(false).
On that new window, I have another button, but when i click it, I got the event corresponding to the fourth button of the first window. Clicking the button again does the trick, but of course t...
I need to find a component's exact screen size in pixels when the main JFrame is resized.
I've tried several things and couldn't find an easy way to do it: it probably have missed something obvious.
BBBBB JFRAME BORDER BBB
BZZZZZZZZZZZZZZZZZZZZZB
BAAAAAAAAAAAAAAAAAAAAAB
BCC1................DDB
BCCC................DDB
BCCC...............
I'm aware of JList and JComboBox.....i need the combo box drop down functionality with multiple selection functionality that JList provides....
This is because the contents of the list are too huge to be displayed using a simple list. I also need to select multiple items, otherwise i would have been content with JComboBox.
Any suggesti...
I am trying to implement a ListSelectionListener for some of my JTables. Simply (at the moment) the ListSelectionListener is supposed to simply return the text of the cell that was selected.
My program design has several JTables and I would like to have one ListSelectionListener work for them all. In the valueChanged event of the ListSe...
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
@SuppressWarnings("serial")
public class Main extends JFrame {
final int FRAME_HEIGHT = 400;
final int FRAME_WIDTH = 400;
public static void main(String args[]) {
new Main();
}
public Main() {
...
Well I know basic Java and wanted to learn Swing so of course looked at the Sun website first, where this tutorial is. I was going to start it but realised it relied heavily on NetBeans, which I'm not sure about.
I'm not sure because it's learning that I want to acheive, not a nice looking program.
So I thought using NetBeans like this...
I'm trying to make a simple 2D game in Java.
So far I have a JFrame, with a menubar, and a class which extends JPanel and overrides it's paint method. Now, I need to get a game loop going, where I will update the position of images and so on. However, I'm stuck at how best to achieve this. Should I use multi-threading, because surely, i...
I want to find a method like isNodeExpanded() to check if a given JTree node is expanded or not, but I can not find it.
I know I can do this by tracking the node expansion with the TreeExpansionListener. Is there a better way?
...
All,
I'm trying to make the properties of my node have Units associated with the measure. ( I am using the JScience.org implementation of JSR 275) So for instance,
public class Robot extends AbstractNode {
// in kg
float vehicleMass;
@Override
public Sheet createSheet() {
Sheet s = Sheet.createDefault();
...
I've just started making my first GUI application in Java and I decided to use the NetBeans IDE to do it. I think its working fine so far, except for one problem; it seems to be slow updating the content of a window.
Even in very simple windows with few controls I find that when - for example - closing or resizing a window, I get the no...
I have a search dialog with a JTextField that's being used as a search box.
When the user types something, it searches the DB, shows the result in a JTable and selects the first item in it.
If the first result is what they were looking for, I want to let them quickly accept the dialog, by pressing Enter (while the JTextField is focused...
Hi everybody!
I've been working with swing for the last 2 years, but i'm still not satisfy with my own work.
The apps are "fast" enough, but the development isn't enough "clean".
Can you recommend me any real world project, book, or something similar that shows me how a real world swing app work. May be a framework, something structure...