3,978 Topics
![]() | |
This is my ScreenManager class which is used for getting the perfect DisplayMode & setting the screen to fullscreen import java.awt.*; import java.awt.image.BufferStrategy; import java.awt.image.BufferedImage; import java.lang.reflect.InvocationTargetException; import javax.swing.JFrame; public class ScreenManager { private GraphicsDevice vc; //give vc access to monitor screen public ScreenManager() { GraphicsEnvironment e = GraphicsEnvironment.getLocalGraphicsEnvironment(); vc … | |
I tried using BorderLayout as in label but does not work package HelloWorldGUI; import javax.swing.*; import java.awt.*; import java.awt.event.*; public class HelloWorldGui { private JFrame a; private JPanel p; private JButton b1; private JLabel lab; public HelloWorldGui() { gui(); } public void gui() { a = new JFrame("window"); a.setVisible(true); a.setSize … | |
Hi All, I have a doubt in paint method of the Component Class. I know how to use that in Applet but im finding it hard to use it in GUI app. Im posting my code here, please edit it to make the program use paint method to render any … | |
I created a String[][] grades, who's size is set by number of students User enters. The array is then populated with my first for loop, and the next for loop is supposed to print out each students date line by line. If I only enter 1 Student and fill in … | |
HI!!!! i am a student of B.Tech 3rd year plz suggest me a mini project in java i have basic knowledge of swing and jdbc and elementary idea of networking | |
Sorry if this is the wrong place or something, but I saw a question in here on PHP vs ASP.NET, which made me think it might be. On the other hand, I also saw posts asking about people's breakfast, so I don't really know... Users are already starting to embrace … | |
Hi! Im new to Java and iv been studying GUI's in it. Just started with swing and tried to make this giu for a calcularot. but it doesnt execute and gives me "java.lang.NoClassDefFoundError" error. im a total noob so i cant figure it out. i'd really appreciate it someone could … | |
I have recently been interested in Java Swing and Game development, so naturally I began creating many different 2D games. During them I found myself having to rewrite much code, but eventually I decided to write some classes that would help me whenever I wanted to make a game. Here … | |
[this](http://docs.oracle.com/javase/tutorial/uiswing/examples/components/TextComponentDemoProject/src/components/TextComponentDemo.java) is the code i was looking at.Its about how to use JTextPane and related swing text Components along with actions and keymaps. my question is that in this part textPane = new JTextPane(); textPane.setCaretPosition(0); textPane.setMargin(new Insets(5, 5, 5, 5)); StyledDocument styledDoc = textPane.getStyledDocument(); if (styledDoc instanceof AbstractDocument) { doc … | |
**Bold Text Here** hey any one can help me sort out my problem.. when i enter the customer id then in tabular format i want its all detail. how to do.. like in textBox i enter customer id as 1 then pressed ok button then in new frame or in … | |
[CODE]import java.util.* public class ArrayMinMax { public static void main(String[] args) { Integer[] numbers={8,2,6,7,1,4,9,5,3}; int min=(int)Collections.min(Arrays.asList(numbers)); int max=(int)Collections.max(Arrays.asList(numbers)); System.out.println("Min number: "+min); System.out.println("Max number: "+max); } }[/CODE] Hi guys, me again. Okay so I use this code in a single array if i want to know what the minimum and maximum … | |
HI I have been building a game applet. I have coded as far as getting rectangles to move on a timer and put integers into the rectangles. I am not familar with how to click the rectangles and I also want to get the different numbers going through an ArrayList … | |
Hi, I am making a simple game,this is my first time to develop java game,but i think i am lost in my code,i could not display or show my bullet when i pressed arrow up,can you help me please how can i achieve on this. here is my simple code. … | |
I am having trouble with the last three methods of my program in the **Board.java**. I'm not sure how to go get it to read gameBoard. It keeps giving me errors. I really cant figure out what I'm doing wrong. All the methods were given to me and cannot be … | |
I am using Netbeans 7.1 and MySQL. I need 1 column in jtable which will contain jradiobutton and user can select any 1 row's jradiobutton Please refer the fig for detail. After selecting RB further processing will be done on jbutton click event.  Here is the code - … | |
We use to import packages in java like import java.util.*; import java.lang.*; import javax.swing.*; But, why is it javax for swing? | |
I have one tab by default (tab1) New tabs are generated , equal to 'No of rooms'. The dynamically generated tabs have same structure as of the default tab. I don't know the name of textfields of newly generated tabs. How can I find the name of jtexfields generated on … | |
import java.awt.*; import javax.swing.*; JPanel middlePanel = new JPanel(); middlePanel.setLayout(new GridBagLayout()); GridBagConstraints cons = new GridBagContraints(); cons.weightx = 1.0; cons.weighty = 1.0; middlePanel.setBorder(new TitledBorder(new EtchedBorder(),"Display Area")); When i use this code snippet(this is just a rough code snippet) i get errors like "can not find symbol GridBagContraints" and "can not … | |
My program is a math game which consists of different levels and different math operations. I'm not completely finished yet but I would like to know if there is a way to put the code for each of the four operators into their own method, and just have the main … | |
Hi, I need some help on this how can i use the arrow keys(up,down,left and right) in the keyboard so that the filloval will move, I have no idea on this.can you help me on this please. Thank you in advance. import java.util.*; import java.awt.*; import javax.swing.*; import java.awt.event.*; public … | |
Hi everyone, I'm stuck making a Scroll pane to see all the bar graphs created when they do not fit on screen, or when the frame is diminished. Can anyone tell me how to do this please? Thanks import javax.swing.JFrame; import javax.swing.JOptionPane; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; import java.awt.*; … | |
Hi everyone, Does anyone have an idea of how to skip a line in a JTextField? In System.out.println, I would normally type n but it didn't work for me when I used it in a textfield: text1.setText(**"n"**+coloumn[counter]); where the output displays well as desired excpet that it doesn't skip a … | |
For the hundredth time I'm listening to **Blackstone Legacy** album (1971) by Afro-American jazz trumpeter Woody Shaw (1944-1989) and I like it exclusively. What kind of music I **don't** like is any sentimental music, so called "smooth" jazz, swing (in the 21st century it sounds too moth-eaten), 99.999% of rock … | |
I'm trying to make this work, and I keep getting errors, can someone fix it and show me what's wrong? I've been trying to fix this for a few days and I can't. Thanks in advance. import java.awt.*; import java.applet.*; import java.util.*; import java.awt.event.*; import javax.swing.*; public class FrameX extends … | |
Hello, My teacher asked us to write a little O.S simulator, my group has to write the file system module. We are using contiguous block alocation for the files, we would like to represent the utilization of the blocks using a colored matrix, where the used blocks would be red … | |
Tryin to sort a search method for abit of code. Have an array list reading from a csv. Any help on how I can get a search method searching through and displaying onto a jTextArea? This is my code in my Gui public class DataGUI extends javax.swing.JFrame { public class … | |
Hello, I have created a GUI using the Netbeans GUI Builder and I have a JTextArea that I want to output to, but because I need to use threads I am doing a lot of processing in an external thread. I am having issues outputting data from the thread class … | |
Hi, I wonder if anyone can possibly help. I am trying to teach myself how to integrate a Java video into a Java GUI / Swing Application. I am pretty competent with building Java graphical user interfaces and the background Java application code, however I am puzzled with how difficult … | |
Im new to java swing, and Ive got a little problem. So I've got a class Flight.java. In there I have a method displaySeat2D(). First I had this done with the scanner. Now I have to use swing. So basically I made text fields to take in number of rows … | |
Hello all, So I have been scouring the internet trying to find an answer to my question. I usually never have to post a question because someone somewhere has asked it, but I guess there is a first for everything. I am a VERY intro level, brand spankin new 'programmer' … | |
I need some help figuring out where I have gone wrong on my program. It is a classic classroom program, where the program creates a random number and gives high, low response untill the user enters the correct number. I have the GUI working and I know the action to … | |
- Please how is possible (probably dirty hack) to create [How to Create Translucent and Shaped Windows](http://docs.oracle.com/javase/tutorial/uiswing/misc/trans_shaped_windows.html) - undecorated container (returns *java.awt.IllegalComponentStateException: The frame is displayable.*) - change Look and Feel for (returns *AWT-EventQueue-0" java.awt.IllegalComponentStateException: The frame is decorated*) - by using code from linked official tutorial . import java.awt.*; … | |
I'm trying to create a multiple choice quiz, and I need the content pane to scroll. If you run the program I've attached you'll see what I mean. Each question and the answers are place in a JPanel and the JPanels are place on the content pane. Thanks in advance … | |
hey all I was watching a tutorial on java game development.In that video,the guy was making a window a on the screen,then making an oval,then moving it. His code worked fine and i am 100% sure that my code is similar to his(i checked it a few times). What my … | |
![]() | I have a project I am working on and it involves java graphics which I am a novice at, I have uploaded the description of the project and the image of how it should look like, now i am having problems implementing the part of introducing the virus and drug … |
I have been having some trouble with this action listener scenareo, and I am doing it exactly like what my java book says to do, and something is still not working. In the action listener the if statement is not working correctly. Here is an example of my code. The … | |
Hey, Does anyone see anything wrong with this? I don't know what's up, it's throwing the IOException everyt time even though the mp3 is in the source folder. (I tried .wav as well). I'm trying to place this in a GUI, but testing it seperately first. import java.io.*; import sun.audio.*; … | |
there are no visible error in the syntax but when i run the application i keep getting the following error. i have been trying to fix it for hours and simply cant find the problem. the error that appears when running is; Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at javax.swing.JComboBox.setModel(JComboBox.java:292) at … | |
I'm working on a Grade Point Average Calculator. The user just have to Select the number of courses offered, then select the grade obtain in the different courses by choosing the appropriate grade from the Choice Box. The problem with my application is that, if the user mistakenly selects "A" … | |
hello i am working on a simple panting project that allow the user to select a shap from ComboBox then draw it on the panel but problem is when is choose any type of shapes and drawing it on panel no shape appear on the panel ?! here is my … | |
Hi guys, I'm having trouble with my code and I'm kind of new in Java so I don't know what to do. I have to do a program with Buttons and each button has to take me to another class (I don't know if I'm being clear). For example if … | |
I am making an examination system desktop application in Java Swing. I have a frame named 'show_class_question' frame. This frame is used to display questions and four options from database. Whenever user clicks 'Next' button I am calling this same frame (show_class_question) again and agian from itself (self - refrencing) … | |
Alright so I am still kinda new to java I am working on a lottery program that will ask the user how many tickets they would like (default being five) and each ticket has a random set of numbers plus a jackpot number: this is the code have so far... … | |
Hey Guys, I am working on a search that takes in a value via textfield. Once taken in it should display another Jframe with the info but the searchbox crashes the second I run it. Its some stupid mistake I have made or i have gone about it the wrong … | |
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 … | |
i am trying to put a java japplet on website. when i run in eclipse it works fine but when i run on website then i get a error: error: on website CacheEntry[http://localhost/eCommerce/menu_pages/game_pages/java_game_3/Main.class]: updateAvailable=true,lastModified=Fri Apr 26 20:39:42 EDT 2013,length=10508 CacheEntry[http://localhost/eCommerce/menu_pages/game_pages/java_game_3/Main$Display.class]: updateAvailable=true,lastModified=Fri Apr 26 20:39:42 EDT 2013,length=2489 Exception in thread "AWT-EventQueue-2" … | |
Hi...! i'm working on a notepad project but i've got a problem in undo action this is my code: import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.Frame; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JFileChooser; import javax.swing.JOptionPane; import java.io.*; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.*; import javax.swing.JLabel; import javax.swing.SwingConstants; import javax.swing.undo.*; public class Notepad … | |
Ok, so here I have a program that creates two boxes. The top box should start out with all 12 months of the year in it. What I'm trying to have happen is be able to move the months (through the two buttons) back and forth. Originally it just had … | |
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, … | |
i have this code to render a locally saved html file onto a jframe. i have the following problems with how the html was rendered: 1. the texts of the 'webpage' do not wrap; 2. in order to solve my problem in 1. above, i added a JScrollPane, problem is, … |
The End.