Search Results

Search found 1571 results on 63 pages for 'swing'.

Page 10/63 | < Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >

  • Problem using FormLayout in Swing

    - by Dimitri
    Hi I am using the FormLayout. I just discovered it and it's powerful layout manager. I would like to layout 4 components (outlined, properties, tgraph, library) in 3 columns. I want to layout my library component on top of the outlined component in one column, the graph and the properties component in one column. But it doesn't work. Maybe I miss something. Here is my code : private void layoutComponent() { JPanel panel = new JPanel(); FormLayout layout = new FormLayout( "right:p,10dlu,300dlu,left:max(50dlu;p)", "top:pref,center:p,p"); layout.setRowGroups(new int[][]{{1,3}}); PanelBuilder builder = new PanelBuilder(layout,panel); builder.setDefaultDialogBorder(); CellConstraints constraints = new CellConstraints(); builder.add(library, constraints.xy(1, 1)); builder.add(outline,constraints.xy(1, 3)); builder.add(tgraph,constraints.xy(3, 1)); builder.add(properties,constraints.xy(4, 1)); getContentPane().add(panel);r code here } Can someone help plz. Thx :)

    Read the article

  • Java Swing - Adding a row # column to a JTable

    - by llm
    I have data from a database loaded into a JTable through a custom table model. I want to have a column (should be the first column) which simply shows the display row number (i.e. it is not tied to any data (or sorting) but is simply the row number on the screen starting at 1). These "column headers" should be grayed out like the row headers. Any idea how to do this? Thanks

    Read the article

  • Java Swing Visual Editor HELP please

    - by bat
    How would i call this function in my main? private JFrame getMainpageframe1() { if (mainpageframe1 == null) { mainpageframe1 = new JFrame(); mainpageframe1.setSize(new Dimension(315, 306)); mainpageframe1.setContentPane(getMainpage()); mainpageframe1.setTitle("Shopping For Less: Main Page"); mainpageframe1.setVisible(true); mainpageframe1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } return mainpageframe1; } public static void main(String[] args) { //call that function to output the JFrame? } thanks

    Read the article

  • Revalidate and repaint - Java Swing

    - by bosra
    I have a JPanel that I am adding JLabel's to. I then want to remove all the JLabels and add some new ones. So I do the following: panel.removeAll();panel.repaint(); panel.add(new JLabel("Add something new"); panel.revalidate(); This works fine. My problem arises when I start a new thread after this like: panel.removeAll();panel.repaint(); (1)panel.add(new JLabel("Add something new"); panel.revalidate(); //new thread to start - this thread creates new JLabels that should appear under (1) firstProducer.start(); try { firstProducer.join(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } Then the output from the original JLabels is still visible. I have read that the revalidate process is a long running task and hence the firstProducer thread is getting started while the revalidation is going on and a conflict is arising. What is the best way to deal with this?

    Read the article

  • How do I make dynamic windows in Swing?

    - by Roman
    I have a general question. I would like to have a window containing some buttons, radio buttons, text fields and so on. So, user can do something (write text, select options and press buttons). As the result of the user activity window should change it structure/appearance some element should disappear and some appear. How do I program such "updates"? Should I close an old window and open a new one or I can modify content of window without closing it?

    Read the article

  • java swing, simulate JTable terminateEditOnFocusLost behaviour

    - by blow
    Hi all, i'm using putClientProperty("terminateEditOnFocusLost", Boolean); to make jtable end editing and clear current selected rows when it lose focus or when simply click over an other GUI component. This is very useful, but with "terminateEditOnFocusLost" there are some strange behaviours if it is used with editCellAt and changeSelection. There are also some undesiderable TableModelEvents fired for some fake table updates. So, im looking for an hack to simulate "terminateEditOnFocusLost without using it, is this possibile? Thanks all.

    Read the article

  • Open a new panel via a button Java Swing

    - by abuteau
    I saw a lot of post on StackOverflow relating to this, but unable to solve my problem. I want to open a new Panel by clicking a button. Here is how i try to do it parameterButton = new JButton("Parametres"); parameterButton.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ createParameterPanel = new DisplayParameterPanel(); createParameterPanel.setVisible(true); add(createParameterPanel); }; }); add(parameterButton); When I click the parameterButton it doesn't open. How can I open a new panel. Thanks,

    Read the article

  • Java Swing rendering bug on Windows 7 look-and-feel?

    - by John B.
    The knob on vertical JSlider's on my Windows 7 machine (with native look-and-feel) is really, really tiny in both directions. Not just skinny but short as well. Can anyone confirm this? Should I report it? If so, where? Thanks! Here is the code for the sample program (in the screen shot): import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JSlider; import javax.swing.SwingConstants; import javax.swing.UIManager; public class SliderTest { public static void main( String[] args ) { // Set the look and feel to that of the system try { UIManager.setLookAndFeel( UIManager.getSystemLookAndFeelClassName() ); } catch ( Exception e ) { System.err.println( e ); } // Launch the GUI from the event dispatch thread javax.swing.SwingUtilities.invokeLater( new Runnable() { public void run () { JFrame window = new JFrame(); window.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); JPanel contentPane = new JPanel(); contentPane.add( new JSlider(SwingConstants.HORIZONTAL) ); contentPane.add( new JSlider(SwingConstants.VERTICAL) ); window.setContentPane( contentPane ); window.pack(); window.setLocationRelativeTo( null ); // Center window window.setVisible( true ); } }); } }

    Read the article

  • Java Runtime Exception

    - by ikurtz
    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 javax.swing.text.BoxView.setSize(BoxView.java:380) at javax.swing.text.BoxView.updateChildSizes(BoxView.java:349) at javax.swing.text.BoxView.setSpanOnAxis(BoxView.java:331) at javax.swing.text.BoxView.layout(BoxView.java:691) at javax.swing.text.BoxView.setSize(BoxView.java:380) at javax.swing.plaf.basic.BasicTextUI$RootView.setSize(BasicTextUI.java:1702) at javax.swing.plaf.basic.BasicTextUI.modelToView(BasicTextUI.java:1034) at javax.swing.text.DefaultCaret.repaintNewCaret(DefaultCaret.java:1291) at javax.swing.text.DefaultCaret$1.run(DefaultCaret.java:1270) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209) at java.awt.EventQueue.dispatchEvent(EventQueue.java:597) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161) at java.awt.EventDispatchThread.run(EventDispatchThread.java:122) as the error does not mention any of my classes, how would i go about in finding what is causing this? if i try: public void notifyChatMessage(String message){...} the error goes away. but if i try: public void notifyChatMessage(Object message){...} the error is reported. please advise.

    Read the article

  • Mod a Swing Arm Lamp into an Adjustable Camera Stand

    - by Jason Fitzpatrick
    If you’re looking for a simple way to get a bird’s eye view to record your DIY projects or other table-based activities like gaming or tinkering, this simple modification to a swing-arm lamp offers a highly flexible camera mount on the cheap. IKEAHacker reader Stef needed an adjustable arm for his iPhone camera so he could record in a top-down-view for some drawing tutorials he was working on. Rather than shell out big bucks for a custom boom arm, he scrounged up a swing arm lamp with a broken shade in the as-is bin at his local IKEA. To mount the iPhone he simply attached a car mount for the iPhone to the swing arm and called it good. Hit up the link below for more pictures; even if you don’t have an IKEA nearby, swing arm lamps are cheap and easy to acquire. Forsa Camera Stand [IKEAHackers] How to Make Your Laptop Choose a Wired Connection Instead of Wireless HTG Explains: What Is Two-Factor Authentication and Should I Be Using It? HTG Explains: What Is Windows RT and What Does It Mean To Me?

    Read the article

  • Guice creates Swing components outside of UI thread problem?

    - by Boris Pavlovic
    I'm working on Java Swing application with Google Guice as an IOC container. Things are working pretty well. There are some UI problems. When a standard L&F is replaced with Pushing pixels Substance L&F application is not running due to Guice's Swing components creation outside of UI thread. Is there a way to tell Guice to create Swing components in the UI thread? Maybe I should create custom providers which will return Swing components after SwingUtilities.invokeAndWait(Runnable) creates them. I don't like the idea of running the whole application in UI thread, but maybe it's just a perfect solution.

    Read the article

  • Is it allowed to load Swing classes in non-EDT thread?

    - by ddimitrov
    After the introduction of Java Memory Model, the Swing guidelines were changed to state that any Swing components need to be instantiated on the EDT in order to avoid non-published instance state. What I could not find anywhere is whether the classloading is also mandated to be on the EDT or can we pre-load key Swing classes in a background thread? Is there any official statement from Sun/Oracle on this? Are there any classes that are known to hold non-threadsafe static state, hence need to be loaded on EDT?

    Read the article

  • Practicing Java Swing

    - by user1265125
    I've been learning Java by myself through many different online and offline resources. I just finished some basic practice and theoretical knowledge of Swing. Now, to become good at it I need some practice problems which would test my Swing skills, including GUI Building, listeners etc. But I can't figure out where to find such questions/problems for my practice. Do you guys know of an online resource? Some book would also do...

    Read the article

  • Java Swing Headaches [on hold]

    - by user107211
    have been using java for quite sometime now(about 4 months). Things seemed to be going smootly till I started learning swing, and am not finding it funny at all, its tideous, unstable(especially layout). I just wanted to know how important it is for programmer to master swing, is it really that important. Is that all there is to desktop applications, because that where I would love to concentrate on. THNKS iN ADvance FoR your COmments

    Read the article

  • Best gui toolkit to use for creating 3D board game

    - by UserInteractive
    I have created a board game using Java and Swing - using GridLayout and various other apis. It works properly but the UI looks very very simple. I would want couple of animations like tilting the GridLayoutat any angle. There are pawns on boxes of the GridLayout that I want to be animated when somebody clicks on it. I'm not sure of the right GUI toolkit to use for this. Swing repaint is possible to a limit and cannot be used for a lot of animation and graphics. And I realized after creating the game that Swing is probably not a good tool to create games. Could anybody suggest a better framework to use that I can use it in Eclipse with Java? I was thinking of JavaFX or tools like Adobe Flash or Adobe Air. Any suggestions please?

    Read the article

  • Can it be done in a more elegant way with the Swing Timer?

    - by Roman
    Bellow is the code for the simplest GUI countdown. Can the same be done in a shorter and more elegant way with the usage of the Swing timer? import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.SwingUtilities; public class CountdownNew { static JLabel label; // Method which defines the appearance of the window. public static void showGUI() { JFrame frame = new JFrame("Simple Countdown"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); label = new JLabel("Some Text"); frame.add(label); frame.pack(); frame.setVisible(true); } // Define a new thread in which the countdown is counting down. public static Thread counter = new Thread() { public void run() { for (int i=10; i>0; i=i-1) { updateGUI(i,label); try {Thread.sleep(1000);} catch(InterruptedException e) {}; } } }; // A method which updates GUI (sets a new value of JLabel). private static void updateGUI(final int i, final JLabel label) { SwingUtilities.invokeLater( new Runnable() { public void run() { label.setText("You have " + i + " seconds."); } } ); } public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { showGUI(); counter.start(); } }); } }

    Read the article

  • With the introduction of the HTML5 <canvas> element, could Swing be implemented in GWT?

    - by knorv
    With the introduction of the HTML5 <canvas> element, could Swing theoretically be implemented in Google Web Toolkit (GWT) by using the <canvas> tag for drawing? I'm aware of efforts to port source code from using Swing calls to GWT calls, but what I'm after is a pure behind the scenes port where a Swing application would compile under GWT without any source code modifications. Is that theoretically possible? Why? Why not?

    Read the article

  • Is possible to make sexy GUI with javaFX & swing ?

    - by phmr
    I would like to do a "sexy" / user-friendly / appealing GUI in java. Swing is a limited in terms of "skin" customisation. I'm thinking about JavaFX but I don't it yet, what can I achieve with this technology ? how hard is it ? do you have examples of real-life examples of Swing/JavaFX integration ? I would like to do something in this spirit of this, which is built on the .NET framework: original link: http://www.patrickpayet.com/net/?p=329

    Read the article

  • Identifying Swing component at a particular screen coordinate? (And manually dispatching MouseEvents

    - by DVA
    I'm doing some work making a Java app compatible with alternative input devices. Unfortunately, the device in question has a Java API that's barely into the alpha stages right now, so it's pretty poor. What I need to do is essentially set up a replacement structure for the dispatch of MouseEvents. Does anyone know if there's a way in Swing to take a screen coordinate and find out what Swing component is displayed on top at that screen point?

    Read the article

  • Netbeans GUI building on pre-defined code

    - by deliriumtremens
    I am supposed edit some code for an assignment, and he gave us the framework and wants us to implement code for it. I load the project into netbeans and can't figure out how I'm supposed to edit the swing components. I don't see how to edit source vs. design. import javax.swing.*; import java.util.*; import java.io.*; public class CurrencyConverterGUI extends javax.swing.JFrame { /************************************************************************************************************** insert your code here - most of this will be generated by NetBeans, however, you must write code for the event listeners and handlers for the two ComboBoxes, the two TextBoxes, and the Button. Please note you must also poulate the ComboBoxes withe currency symbols (which are contained in the KeyList attribute of CurrencyConverter CC) ***************************************************************************************************************/ private CurrencyConverter CC; private javax.swing.JTextField Currency1Field; private javax.swing.JComboBox Currency1List; private javax.swing.JTextField Currency2Field; private javax.swing.JComboBox Currency2List; private javax.swing.JButton jButton1; private javax.swing.JPanel jPanel1; } class CurrencyConverter{ private HashMap HM; // contains the Currency symbols and conversion rates private ArrayList KeyList; // contains the list of currency symbols public CurrencyConverter() { /************************************************** Instantiate HM and KeyList and load data into them. Do this by reading the data from the Rates.txt file ***************************************************/ } public double convert(String FromCurrency, String ToCurrency, double amount){ /*************************************************************************** Will return the converted currency value. For example, to convert 100 USD to GBP, FromCurrency is USD, ToCurrency is GBP and amount is 100. The rate specified in the file represent the amount of each currency which is equivalent to one Euro (EUR). Therefore, 1 Euro is equivalent to 1.35 USD Use the rate specified for USD to convert to equivalent GBP: amount / USD_rate * GBP_rate ****************************************************************************/ } public ArrayList getKeys(){ // return KeyList } } This is what we were given, but I can't do anything with it inside the GUI editor. (Can't even get to the GUI editor). I have been staring at this for about an hour. Any ideas?

    Read the article

< Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >