- Strength to Increase Rep
- +12
- Strength to Decrease Rep
- -3
- Upvotes Received
- 145
- Posts with Upvotes
- 128
- Upvoting Members
- 55
- Downvotes Received
- 20
- Posts with Downvotes
- 19
- Downvoting Members
- 12
953 Posted Topics
Re: - (FileIO, JDBC) Socket are long and hard actions, - Swing in single threaded and updates to already visible Swing GUI must be done on Event Dispatch Thread, code from hard and long running events by default never to notify EDT, as you can see in your code, every notification … | |
Re: at begining change classname from log to MyLog, to avdiods the conflict with reserved words for some Java Method Name [CODE]public void actionPerformed(ActionEvent e) {[/CODE] create a new class which contains just one TopLayoutCOntainer (JFrame, JDialog...) in type to the main method and inside actionPerformed [CODE]MyLo ml = new MyLog … | |
Re: great, empty and unnecessary reply I'm vote jon.kiparsky and you | |
Re: 1. about last column ( "Accept/Reject" ) - how can I reject ??? with simple JButton - JOptionPane should be always wrapped into invokeLater - moved to the end of EDTs queue 2. when teacher click a row - override isSelected in your Xxx(Table)CellRenderer / prepareRenderer, there is place to … | |
Re: - for why reason(s) there is/are two arrays, models, ArrayList and DefaultTableModel - add records from database to DefaultTableModel directly, then to add model to JTable - search for TableFromDatabase, ResultSetTableModel | |
Re: 1) validate & invalidate is Look and Feel sensitive, and for some JComponents doesn't works correctly 2) validate is for add new JComponents to already Visible Container 3) revalidate is for remove JComponent (and then maybe add new JComponent) from / to already Visible Container 4) part of JComponents required … | |
Re: there is significant difference WindowListener is designated for add (code block e.g. closing resources before) control the closing JVM processes in comparing with the JFrame.setDefaultClose.... | |
Re: @JamesCherrill wrote - Interesting question. A quick Google doesnt reveal any subclasses for Graphics2d - maybe they are private?, ---> not is available only for its parent - Graphics, @JamesCherrill wrote - Please post the answer here if you do find it! ---> yes, no problem with, e.g. :-) @Override … | |
Re: - assuming to store value as Date, TimeStampt in database - you have to use ResultSet.getDate() instead of little bit crazy parsing and then formatting String instance ... - every JDatePickers/JCalendar has setValue/Date(Date/Calendar), - every good JDatePickers/JCalendar has own FAQs with code examples - SpringLayout isn't good LayoutManager for newbee … | |
Re: crossposted on [CodeRanch](http://www.coderanch.com/t/651240/GUI/java/mouse-events-close-jdialog) | |
Re: JOptionPane is designated to returns multiple value from multiple fields two ways as is, - primitive array - (intialized) variables _________________________________________________________________ in all cases is required to test for (easiest by using if - elseif - else) switch (result) { case JOptionPane.OK_OPTION:// and returns from various JButtons // code break; … | |
Re: 1. put number to JTable column, better to play with model only 2. override getColumnClass for correct datatype (String, Double, Date, Icon...) 3. loop in concrete column by call getValueAt, result from this loop to add JTextField | |
Re: I need to know .... new version. ---> no one of Insubstantials members is not here active | |
Re: secondary - put all graphics objects to the List - inside paintComponent loop inside array of Objects ______________________________________________________ important - don't to call anything from paintComponent - GeneralPath mouthAndTeeth = new GeneralPath(); those object must be prepared before, storred in array of painting, - paintComponent is designated for custom painting, … | |
Re: 1. override getPrefferedSize instead of hunting for pixels perfections e.g. diff.getWidth()/getHeight(); 2. then inintial calculations about Width/Height is missunderstaning, thats should be part of paintComponent where getWidth()/getHeight() returns real pixels perfections at runtime 3. KeyListener is last of property for animations in Swing, use KeyBindings instead 4. there isn't reason … | |
Re: - use methods from [SwingUtilities](http://docs.oracle.com/javase/7/docs/api/javax/swing/SwingUtilities.html#isLeftMouseButton%28java.awt.event.MouseEvent%29), because there is mouse with 5 buttons - [AWTEventListener](https://docs.oracle.com/javase/7/docs/api/java/awt/event/AWTEventListener.html) can returns [MouseEvents](https://docs.oracle.com/javase/7/docs/api/java/awt/AWTEvent.html) too - have to accept that isn't possible to create two events from Mouse or KeyBoard in the same time | |
Re: [crossposted](http://stackoverflow.com/questions/29347965/rename-file-directory-using-jfilechooser-and-jbutton) | |
Re: override (based on code posted here) - getPreferredSize for GridPanel - use getHeight/Weight in paintComponent - change scroll increment for JScrollBar for natural scrolling _________________________________________________________________ important everything is elsewhere - no one knows how, what, where, why a size has JFrame, actual part of JSplitPane, not Dimension from JScrollPane, much … | |
Re: I was looking for a few tips on where to get started? - is possible define MAPDATA as enum - depends of design I'm miss there tileCount == U32 and U32 == tileCount | |
Re: quite disagree with @JamesCherrill 1. for Java animation is to use a java.util.Timer scheduleAtFixedRate == not is about Swing Timer with repaint or it should be from any more accurate timer (doesn't matter - java.util.Timer), but events are out of EDT in Java7/8 (removed all thread safe methods, incl. a … | |
Re: but when I resize the window, the shapes change into new ones. - talking about resize from container to call repaint(from methods implemented in API), thats correct - create an array of Object, inside paintComponent loop inside this array, instead fo creating a new set of Obejcts, because paintComponent is/can … | |
Re: - [quite complete list of JWS](http://stackoverflow.com/tags/java-web-start/info), - also read jnlp ([Java Network Launching Protocol](http://stackoverflow.com/tags/jnlp/info)) - completed by [Andrew Thompso](http://stackoverflow.com/users/418556/andrew-thompson)n | |
Re: - code (skeleton, logics) is correct, - not reason to setContentType("text/html"); at runtime | |
Re: I want to copy TextArea text to a File... == for me (including properties from NativeOS, newline, tab, .....) is [JTextArea.write](http://docs.oracle.com/javase/7/docs/api/javax/swing/text/JTextComponent.html#write%28java.io.Writer%29) | |
Re: - JOptionPane can returns number, date, image, string - as is mentioned read API/Oracle tutorial - How to use Dialogs - two-three parts about JOptionPane | |
Re: [crossposted](http://stackoverflow.com/questions/28208443/printing-from-a-jtable-including-logo-and-footer) | |
Re: TableCellRenderer is called from all (could be very intensive, short period and repeatly) - Mouse Events inside JTable - Key Events - events implemented in rellated APIs | |
Re: I'm think that is designated for Swing Action | |
Re: - JTable with KeyListener hasn't someting (never, doesn't react to) with KeyEvents in the TableCellEditorr, this is separate JComponent - fpr more informations about to read Oracle tutorial HOw to use Tables, part - Concepts: Editors and Renderers - never to use low level KeyListener for Swing JComponents, every JComponents … | |
Re: another issue is scr1.getViewport().add(txar1,null);, don't to use JViewport as container, for more info to read Oracle tutorial - [How to Use Scroll Panes](http://docs.oracle.com/javase/tutorial/uiswing/components/scrollpane.html) | |
Re: How could I use these values to get a row? depends of array type where those Objects are stored, in most to todays arrays == get a number,from row 3, item 7. (accepts == e first row is row 0, first item on row is item 0. as noticed by … | |
Re: - good catch by @JamesCherrill "use this JLabel in a JTextPane"?, - use JEditorPane, without using JLabel as container for image (is possible but there couldn't be real reason for ...), - or JLabel (without parent from JTextComponents) is correct way to do that too | |
Re: @JamesCherrill You could store your button references in a 10x10 array (or a 100 element array) as you create them. hmmm why bothering with, most of Object in Java APIs has historical artifacts from the distant past - [public final void putClientProperty(Object key, Object value)](http://docs.oracle.com/javase/7/docs/api/javax/swing/JComponent.html#putClientProperty%28java.lang.Object,%20java.lang.Object%29) then (for/grom Swing rellated APIs) … | |
Re: [crossposted](http://stackoverflow.com/questions/27221175/jcheckbox-and-jcheckboxmenuitem-java) | |
Re: read Oracle tutorial - How to use Tables, part Specifying Tool Tips for Cells | |
Re: Yes i know that but still i didn't see the scroll bar on jframe... there are three possible issues - contents Size that you put ot the JScrollPane is lover than JViewPort View - you nothing put to the JScrollPane - change XXX_SCROLLBAR_AS_NEEDED to XXX_SCROLLBAR_AS_ALLWAYS | |
Re: 1. Please enter an integer 2. value cannot be 0 or negative put there JFormattedTextField, better JSpinner with number formatter, more in Oracle tutorial | |
Re: [CardLayout](http://docs.oracle.com/javase/tutorial/uiswing/layout/card.html) | |
Re: (isn't my cup of java) but you have to set for Scene size (if I'm remember correctly) | |
Re: 1. read [Initial Thread](http://docs.oracle.com/javase/tutorial/uiswing/concurrency/initial.html) 2. create JFrame as local variable 3. where going code line menuPanel.setLocation(0, 0);, because JFrame has BorderLayout in API 4. mode code lines from private void initGUI() and private void addGUIComponents() to constructor public PokeBase() 5. put LineBorder to JPanel for testing purposes 6. JTree should … | |
Re: Or is it something that with time I will just know? -yes you have to accept that some XxxListener firing only one events, another two | |
Re: - only one JRadioButton can firing SELECTED event in the case that they are added ButtonGroup - (something that make me some sence) use JRadioButtons with ItemListener without limitation came from ButtonGroup, or add JRadioButtons to ButtonGroup listened by ActionListener - (hightlevel) is possible, you can play with AbstractButton, better … | |
Re: - use [Swing Timer](http://docs.oracle.com/javase/tutorial/uiswing/misc/timer.html) instead of Thread.sleep() | |
Re: @JamesCherrill most of us living in 21th. century, then little bit modified (actual research about interest to learnt something new) - time ---> 85-90pct of scale - willingness to spent this time ---> 7-8pct of scale - access to a computer and the internet ---> 2-3pct of scale - reasons … | |
Re: seems like as author of [Official Oracle tutorial about CardLayout overtaken this question for about a few years....](http://docs.oracle.com/javase/tutorial/uiswing/layout/card.html) | |
Re: too hard to say something cleaver (after question is already answered by @JamesCherrill), just about good practicies that haven't any conflict(s) with methods implemeted in Layout Managers APIs (sizing of screen, setXxxSize, ...) import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.GridLayout; import java.awt.LayoutManager; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import … | |
Re: - most of GUI APIs, frameworks are single threaded - Swing/AWT GUI doesn't care that Workers Thread update Swing/AWT methods (from =>Java4), or freeze until heavy and long background task ended, without repainting programatically to Swing GUI by using invokeLater (just methods implemented in Swing/AWT APIs) - your code snippeds … | |
Re: I'm doubt that question in this form is answerable, you have to provide more effort than that | |
Re: for why reason(s) to call class_members (maybe is/are important == homework) from outside and basics JButtons methods | |
Re: another of reasons to post an SSCCE, short, runnable, compilable with hardcoded value in local variable for JTable/XxxTableModel instead of shadowing JDBC |
The End.