165 Topics

Member Avatar for
Member Avatar for trishtren

Hello, I was hoping someone can help me, im looking for a way to extend a basic shape class in particular the roundedrectangle2d class and be able to draw it in the same way we could handle an object with a simple call to g.draw(object instance); However im having problems …

Member Avatar for JamesCherrill
0
368
Member Avatar for modesto916

Hi there, I'm just starting with Java and Desktop programming but I have some doubts, for example: You are going to write a new application, you go there, draw your ER for your database, UML, etc. My problems is when I need to integrate the interface with the program logic, …

Member Avatar for stultuske
0
207
Member Avatar for Pobunjenik

Allright. It's me again. :D This time, I'm making an alarm clock program. I've already completed the bit that gets and displays the system time: Date vrijeme = new Date(); int sati = vrijeme.getHours(); int minuti = vrijeme.getMinutes(); int sekunde = vrijeme.getSeconds(); Also made a method that compares that time …

Member Avatar for Pobunjenik
0
933
Member Avatar for XerX

Hello. I am trying to recreate manually a small celsius-to-fahrenheit converter that I created with Design view before that. I used its code for reference, but still doesn't work. When I run my code I don't get the components drawn on the screen, only an empty window. What am I …

Member Avatar for XerX
0
1,000
Member Avatar for andra.durdun

Hello! I am using for the first time the JTabbedPane. The problem that I have is that I want to apply the paint method only for the first tab, but it also paints the second one. How can I solve this problem?

Member Avatar for stultuske
0
110
Member Avatar for rancosster

I have a problem with creating drag and drop in Swing. I have written class that represents the toolbar item here is the code shortened code for it: public class ToolbarItem extends javax.swing.JToggleButton implements IToolbarItem, Transferable, DragSourceListener, DragGestureListener { private ModelEquivalent _modelEquivalent; private DragSource _dragAndDropSource; private TransferHandler _itemTransferHandler; public ToolbarItem(ModelEquivalent …

Member Avatar for rancosster
0
453
Member Avatar for DavidKroukamp

I have seen many questions on autocompeletion for *java text components* like `JTextField` `JTextArea` `JTextEditorPane` etc. There are not many options either: 1) 3rd party library (like SwingX) 2) DIY (i.e using `DocumentListener`, `JWindow` with `JLabel` etc and a few requestFocusInWindow calls) I chose number 2 and put the code …

Member Avatar for bguild
1
1K
Member Avatar for M4trixSh4d0w

Hi, i'm making a java program, and I started making the gui with a `JTextArea`, and tried to add a font (`Consolas`) and It crashes with a "divide by 0" error. It works fine on windows, and if you comment out the `setFont` line.. import javax.swing.*; import java.awt.Color; import java.awt.Font; …

Member Avatar for M4trixSh4d0w
0
500
Member Avatar for fazae

import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; public class Calculator extends JFrame{ // Declare GUI components private JTextField jtfFirst; private JTextField jtfSecond; private JTextField jtfResult; private JLabel jlblFirst; private JLabel jlblSecond; private JLabel jlblResult; private JPanel entryPanel; private JPanel buttonPanel; private JButton jbtAdd; …

Member Avatar for fazae
0
230
Member Avatar for SoulofchaOs

There are 2 sets of 4 buttons being created. The `ImageIcon` of the 1st set of buttons are to be dragged onto the 2nd set of buttons. The boolean `enab` variable is for determining if the 2nd set of 4 buttons are enabled or not. I initially set the boolean …

Member Avatar for JamesCherrill
0
201
Member Avatar for 03hasnam

From Class Model: public TableModel getTableData() { TableModel model=null; try { String sql = "SELECT eventID as 'Event ID', date as 'Date',eventName as 'Name', time as 'Start Time' FROM Event"; pst = conn.prepareStatement(sql); rs = pst.executeQuery(); model = (DbUtils.resultSetToTableModel(rs)); } catch(SQLException e){ e.printStackTrace(); } finally { try {rs.close(); pst.close(); } …

Member Avatar for Taywin
0
235
Member Avatar for SoulofchaOs

I am coding an image puzzle game and one part of the code is to compare the pieces the user has selected to the pieces of the correct image to check if it is correct. Each image piece is already added to a JButton as an ImageIcon. An identifier is …

Member Avatar for mKorbel
0
246
Member Avatar for 03hasnam

public class EventView extends javax.swing.JFrame { Connection conn = JavaConnect.ConnectDB(); PreparedStatement pst = null; ResultSet rs = null; private EventModel model; /** Constructor */ public EventView(EventModel model) { initComponents(); this.model = model; updateEventTable(); } public void addEventListener(ActionListener al) { addEventButton.addActionListener(al); } /* public void clearListener(ActionListener cl) { clearEventButton.addActionListener(cl); }*/ public …

Member Avatar for JamesCherrill
0
136
Member Avatar for ynmly

how to change image when button is clicked? my gui is consisting of three Button(NEXT,PREVIOUS,AUTO-CHANGE) and 1 Jcombobox. when you drop-down combobox list of image is shown.so i want when i clicked on "next" button image of jcombobox should be change.

Member Avatar for stultuske
0
185
Member Avatar for vegaseat

Jython is a version of Python that can use the extensive Java library. Jython uses Python syntax and avoids the rather ugly syntax (at least for Pythonions) of Java. Here we apply it to bring up an image from a file.

4
709
Member Avatar for geedow

Dear all, This example is compleet ,but wont load the file. Can anyone help me with puzzle?hier is the code: Class ATMWindow import java.io.IOException; import javax.swing.JFrame; public class ATMWindow { /** * @param args the command line arguments */ public static void main(String[] args) { if (args.length == 0) { …

Member Avatar for Taywin
0
204
Member Avatar for 03hasnam

I am finding it difficult to update the `JTable` when I enter a person's name in search button. The program compiles correctly without any errors, but in `SearchActionPerformed` event when the search button is pressed an empty table comes up. Where without search, the table is full of values from …

Member Avatar for tux4life
0
558
Member Avatar for 03hasnam

Hi, I have something wrong at table_academicMouseClicked() method which results me with a java.lang.NullPointerException error. basically trying to compare the surname in Jtable and look it up on the database to select the corresponing record so that I can set the label to the value from database. So when a …

Member Avatar for Taywin
0
491
Member Avatar for 03hasnam

I am unable to execute the editProfile() method in MainMenu class. The purpose of the method is to be able to extract the bean values and display them on the empty textfield. I am not sure if i did it correctly. any recommendations for any changes to editProfile() method. public …

Member Avatar for 03hasnam
0
508
Member Avatar for NidhishKrishnan

i've done an application with two JTextField with the autocomplete feature the application works fine but On clicking the Tab Button while the mouse pointer is on the first TextField the Mouse focus is not going into the second Textfield but gets the focus on the second time. i.e for …

Member Avatar for radhakrishna.p
0
810
Member Avatar for ruthvik.vijaykumar

I am creating this Word Processor...for my college project...an i hav this bugging problem, i have this text area which has a popup menu,this popup menu has a listener(below)..now comming to the point when i right click the TextArea a grau colored popup come up(all the menu items hidden) only …

Member Avatar for stultuske
0
140
Member Avatar for nickecarlo

I have this program where when I click start, it starts painting rectangles one on top of the other by storing each rectangle created by paintComponent in an array and then displaying them on the screen. When I click stop, the animation stops. This is all fine and dandy but …

Member Avatar for JamesCherrill
0
2K
Member Avatar for wannafzan

This is my assignment. I've done it 36 hours straight and I can't think properly so my program looks like kindergarden kid's program. Basically, we have to do a GUI for Pizza ordering. Everything works except for the amount. The output for amount is "0.00". I have to send it …

Member Avatar for wannafzan
0
2K
Member Avatar for crownedzero

I'm just curious about the use of frames/panels etc. What's are your general practices and why? Single main JFrame with multiple internal then toggling visibility of panels within? Just starting with swing and rather curious how other people implement them.

Member Avatar for jalpesh_007
0
135
Member Avatar for mukiibi

This code can help you to find the square root of three numbers accepting the inputs from the user and displaying the results in a Joption pane. let me hope it will help import javax.swing.JOptionPane; import java.text.DecimalFormat; public class Squareroot { public static void main(String[] args) { String stringNum1,stringNum2,stringNum3; double …

0
96
Member Avatar for cyanide911

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 …

Member Avatar for NormR1
0
166
Member Avatar for alastair1008

basically my program runs like this 1. open up configure GUI 2. get congiguration 3. close configure GUI 4. open up main GUI now when I am testing in netbeans, this works perfectly however, as soon as I compile and try to run the jar file outside of netbeans the …

Member Avatar for alastair1008
0
217
Member Avatar for Ricky116

Hi folks, I have been making a marquee scroller that reads the text coming from the right to the left, so setting a JLabel's text using setText() starting with 60 spaces and one character-long substring, to zero spaces and 60 character-long substring. I've noticed that immediately, the jlabel's text starts …

Member Avatar for Ricky116
0
914
Member Avatar for Hakoo

Hello, I am facing this difficulty here : First I'll give code public class Game extends JFrame { private JPanel contentPane; //private JPanel settingPane; protected JLabel lblPlayerName2; // I am using this one for my testing JLabel[] lbls = new JLabel[9]; private final ButtonGroup buttonGroup = new ButtonGroup(); public static …

Member Avatar for Hakoo
0
288
Member Avatar for lo0lo0999

import java.awt.*; import java.awt.event.*; import javax.swing.*; public class Bank1 extends JFrame { private JLabel l1; private JLabel l2; private JTextField t1; private JPasswordField p1; private JButton b1; public Bank1() { super("Bank System"); Container container = getContentPane(); container.setLayout(new FlowLayout()); l1=new JLabel(" ID :- "); container.add(l1); t1=new JTextField(25); container.add(t1); l2=new JLabel(" Password …

Member Avatar for mKorbel
0
215

The End.