Hi, I'm using NetBeans with Java. I have create a JFrame with some checkboxes and a button to open browser go to the specific URL based on the checkboxes' values. But how do I auto-login/auto fill the username and password textbox then trigger the login button? Please kindly advise. Thanks.

Member Avatar
Member Avatar
+0 forum 7

Flickering occurs when Active Rendering with JPanel, not sure why as I've done this before (couldn't find source code of that project however). Relevant Code: Graphics g = projectDCWindow.getWindowGraphics(); // Gets the Graphics Object from a JFrame g.setColor(Color.BLACK); g.fillRect(0, 0, (int) ProjectDCInfo.getDefaultWindowSize().getWidth(), (int) ProjectDCInfo.getDefaultWindowSize().getHeight()); // Clears the screen projectDCGSM.get().render(g); // Game State Manager which simply draws to the Graphics Object g.dispose(); This is where I draw to the Graphics Object, drawX and drawY are being updated g.setColor(Color.BLUE); g.fillRect(drawX, drawY, 100, 200); The JFrame Code private JFrame projectDCWindow; protected ProjectDCWindow() { projectDCWindow = new JFrame(WINDOW_TITLE); projectDCWindow.setPreferredSize(getDefaultWindowSize()); projectDCWindow.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); projectDCWindow.addWindowListener(new WindowAdapter() { @Override …

Member Avatar
Member Avatar
+0 forum 8

I am trying to make a calculator, but I can not seem to figure out how to get the = operation to work. Everything else seems to be working fine, but I am just really struggling with the =. Any guidance in the right direction would be super helpful! import javax.swing.JFrame; import javax.swing.JTextField; import javax.swing.JPanel; import javax.swing.JLabel; import javax.swing.JButton; import java.awt.BorderLayout; import java.awt.GridLayout; import java.awt.Color; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; public class Calculator extends JFrame implements ActionListener { public static final int WIDTH = 400; public static final int HEIGHT = 400; public static final int NUMBER_OF_DIGITS = 30; JTextField jb …

Member Avatar
Member Avatar
+0 forum 1

Hello Everyone, I am experiencing errors when trying to compile a project in Java 8. The errors are caused by swing components. The code I am using is the following: import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; public class Main2 { public Main2(){ JFrame f = new JFrame (); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setSize(100, 100); JPanel p = new JPanel(); JLabel l = new JLabel("Test"); p.add(l); f.add(p); f.setVisible(true); } public static void main(String[] args) { new Main2(); } } The problems are caused by the p.add(l) and the f.add(p). They throw a `The method add(JLabel) is undefined for the type JPanel` and a `The …

Member Avatar
Member Avatar
+0 forum 3

I would like code to display ms access database dynamically in a jframe . here is my database.**[img]http://i.imgur.com/PtuGLnX.png?1[/img]**.I tried searching a lot but i think i need personal help in this area as this is a suppose to be dynamically updated Jframe.on the other hand i am open to suggestion to how to better display the database(considering the details IDE:eclipse luna for java ee,ms access 2010,my website is in .jsp file).thanks in advance.

Member Avatar
Member Avatar
+0 forum 6

Hi. I have a JFrame with a JLayeredPane. On the first layer there is a table, then above it there is black transparent layer that allows me options and what-not. I animate the arrival of this transparent layer. However when I do this the panel seems to loose it's transparency, that is until I interact with the base layer, THEN I see through the transparent layer again. Sometimes, when I start interacting with the textfield or button on the transparent level, it starts displaying pieces and bits of the lower layer on the Transparent layer. Am I missing the need …

Member Avatar
Member Avatar
+0 forum 2

I am writing a application.and i need to draw line in jpanel.but it is crash when jpanel add to jframe.this is my code: public class Simplification extends JFrame { JPanel panel; public Simplification(List<List<Integer>> transmitionTable , List<List<Integer>> outTable) { this.setTitle("Simplification Result"); this.setSize(500, 300); this.setLocation(50, 50); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setVisible(true); // do other jobs panel = new JPanel() { protected void paintComponent(Graphics g) { super.paint(g); g.drawLine(0, 0, 11, 11); } }; panel.setVisible(true); this.add(panel); } }

Member Avatar
Member Avatar
+0 forum 1

I was thinking if it would be possible to create a JFrame, and make the title of it to change, such as make the title work as a counter that will display some text like: The window was opened for 1 second. The window was opened for 2 second. The window was opened for 3 second. The window was opened for 4 second. The window was opened for 5 second. The window was opened for 6 second. The window was opened for 7 second. Here is the code I have so far: import javax.swing.JFrame; class WindowFrame { public static void …

Member Avatar
Member Avatar
+0 forum 5

I need help making this to display the results into a Jframe GUI instead of a console im failry new to java so please help me thanks, here is the code ive used: import java.util.ArrayList; public class ThreeArrayLists { public static void main(String[] args) { ArrayList priceList = new ArrayList(); ArrayList quantityList = new ArrayList(); ArrayList amountList = new ArrayList(); //PRICE lIST priceList.add(new Double(10.62)); priceList.add(new Double(14.89)); priceList.add(new Double(13.21)); priceList.add(new Double(16.55)); priceList.add(new Double(18.62)); priceList.add(new Double(9.47)); priceList.add(new Double(6.58)); priceList.add(new Double(18.32)); priceList.add(new Double(12.15)); priceList.add(new Double(3.98)); //QUANTITY LIST quantityList.add(new Double(4.0)); quantityList.add(new Double(8.5)); quantityList.add(new Double(6.0)); quantityList.add(new Double(7.35)); quantityList.add(new Double(9.0)); quantityList.add(new Double(15.3)); quantityList.add(new Double(3)); quantityList.add(new Double(5.4)); …

Member Avatar
Member Avatar
+0 forum 5

Hello Good day. I have an interesting question as it relates to adding a background image to a JPanel (or whichever component is best for what I'm trying to achieve. Hopefully I'll get some help here.) I have a large picture that I want to use as a background image and I want it to be the background for my JFrame. The only thing is that I don't want the image to resize when the JFrame resizes. I want the image to remain centered in relation to the JFrame's position and size, but I just don't want the view of …

Member Avatar
Member Avatar
+0 forum 3

Hi, I have a png image wihtout background and want this png to be my JFrame where the transparent section must be transparent; I have tried different ways I used the setOpaque(), setOpacity(), ImageIO but no clue. I want only my transparent png as JFrame. Any idea and solution will be appreciated.

Member Avatar
Member Avatar
+0 forum 2

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 Frame { JFrame frame = new JFrame("FrameX Project"); // Add a window listner for close button frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); // This is an empty content area in the frame FrameXLabel FrameXlbempty = new Label(""); FrameXlbempty.setPreferredSize(new Dimension(500, 500)); frame.getContentPane().add(FrameXlbempty, BorderLayout.CENTER); frame.pack(); frame.setVisible(true); public …

Member Avatar
Member Avatar
+0 forum 4

I'm using netbeans IDE and I created a Jframe with two Jpanels one is for Jbuttons and other one is for load another Jpanels to it when clicks those buttons. I tried to do it from buttonclick action. Jpanel2 j2=new Jpanel2(); JPanel1.add(j2); j2.setVisible(True); but this code is not working. I want to know how can I do this. (I think this is also same as loading JinternelFrames)

Member Avatar
Member Avatar
+0 forum 1

I have been tryin to get this to work for the past week if not two >:( with no joy. Worst of all its such a trivial problem. The program asks you to choose a town name from a combo box when you choose the location you shoud be brought to a brand new Jframe with a populated Jtable. Now everything does what its meant to do except the jframe window which opens as the border of the window and the minmise,maximise and close buttons. You can view the database by expanding the jframe window from the bottom right corner(Click …

Member Avatar
Member Avatar
+0 forum 7

I've had enough. I just don't get what's wrong at all. I coded a basic calculator program, and it compiled correctly, no exceptions thingy, sooo... it's probably my mistake --- nothing appears on the calculator's GUI. It's a blank window with just the title. And when executing programs like this, shouldn't something be happening in the command prompt before the program pops out (well, that's what happened in my previous not-so-good-yet-working-calculator)? ![e089c71c338bd44e978b452b4f7c56c7](/attachments/fetch/L2ltYWdlcy9hdHRhY2htZW50cy80L2UwODljNzFjMzM4YmQ0NGU5NzhiNDUyYjRmN2M1NmM3LnBuZw%3D%3D/500 "e089c71c338bd44e978b452b4f7c56c7") *** Note: I am actually very embarassed to even post this thing since I haven't checked on anything yet, like if the program does what it's supposed …

Member Avatar
Member Avatar
+0 forum 9

Hello Everyone, I understand this is a basic problem, with a simple solution, but I cannot find a way to fix it. I'm trying to add a Jpanel to a JFrame and when I do the following. g.drawString("HELLO", 500, 0); The string is not seen on screen now if I do g.drawString("HELLO", 500, 5); This can be half-seen at the top, and perfectly if I make the y position 10 pixels. So I guess it has an offset of 10pixels (I don't know if this is the right word). The Frame class its... package Graphics; import java.awt.BorderLayout; import java.awt.Dimension; import …

Member Avatar
Member Avatar
+0 forum 2

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.

Member Avatar
+4 forum 0

This is my program so far: package allin1; import javax.swing.*; import java.awt.event.*; import java.awt.*; public class Allin1 { JFrame frame = new JFrame(); JPanel panel = new JPanel(); JButton b1 = new JButton("Exit"); public static void main(String[] args) { panel.add(b1); //THIS IS THE PROBLEM?? } } The error I am getting from this is, "***Non-static variable panel, cannot be referenced from a static context***". I am not exactly clear what to do about this to be honest. I am fairly new to Java, and the whole static, public thing is beyond me truly.... **Please help me with this!!**

Member Avatar
Member Avatar
+0 forum 4

Ok so I am trying to build a little program and I want to be able to click on the skate or dice button and have the program open a new JFrame that has been built in another class. Currently it opens its own JFrame that was built in this method. I have the other classes built i have put the skate class below the main menu method. If someone could help me get this work I would greatly appreciate it. Another thing I tried is the getContentPane and that creates and exception in the thread Main method public class …

Member Avatar
Member Avatar
+0 forum 3

I am not seeing why this code will not generate the output to my JFrame after it takes the input from the text file? How can I tweak this code to do that? Take input from file and display it on JFrame... JTabbedPane jtpane=new JTabbedPane(); JPanel jpan=new JPanel(); JTextArea txt=new JTextArea(); FileReader f = null; try { f = new FileReader("PatientCollect.txt"); } catch (FileNotFoundException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } BufferedReader brk=new BufferedReader(f); String s; try { while((s=brk.readLine())!=null){ txt.append(s); } } catch (IOException e1) { e1.printStackTrace(); } jpan.add(txt); jtpane.addTab("Tab1",txt); this.add(jtpane); this.setVisible(true);

Member Avatar
Member Avatar
+0 forum 2

So I am trying to make a tile map editor/reader to create and interact with maps like [this](http://www.codeproject.com/KB/game/Autotiles_Algorithm/TileMapExample.png) , so essnetially I am wondering what the best way to go about this would be. I have not done anyhting graphical in programming in a long time and yeah, I was thinking an arary of jlabels on a jframe? Anyone have any suggestions / ideas? thanks

Member Avatar
Member Avatar
+0 forum 3

Hi I want to be able to change the name of the JFrame I am working on. It is currently named SwimmingPoolVolumeCalculator. When I go the Company Tab and enter in a name, I want that name to be shown as the new Title of the JFrame. How can i do this? Here is my code: public class SwimmingPoolVolumeCalculator<exitHandler> extends JFrame { /** * */ private static final long serialVersionUID = 1L; JLabel welLabel = new JLabel("Welcome"); JComponent date1; JLabel dateLabel = new JLabel("Today's Date is:"); JFormattedTextField date = new JFormattedTextField(java.util.Calendar .getInstance().getTime()); JButton exit = new JButton("Exit"); JLabel contractor = …

Member Avatar
Member Avatar
+0 forum 2

Hi.. I want redirect a frame into next frame. In swing method how to redirect a frame into next frame ?

Member Avatar
Member Avatar
+0 forum 2

Hi, How do you disable the minimize button in a JFrame. I only want to disable the minimize button, not the close and maximize button. Please help me with this one. Thanks.

Member Avatar
Member Avatar
+1 forum 2

I want to write a version of the SAND GAME. I want to examine the color of every pixel in a Jframe window. I use something like this. Toolkit toolkit = Toolkit.getDefaultToolkit (); Dimension dim = toolkit.getScreenSize(); int height = dim.height; int width = dim.width; GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice gs = ge.getDefaultScreenDevice(); GraphicsConfiguration gc = gs.getDefaultConfiguration(); BufferedImage bimage = gc.createCompatibleImage(width, height, Transparency.TRANSLUCENT); for (int y = height - 1; y >= 0; y--) { for (int x = width - 1; x >= 0; x--) { int rgb = bimage.getRGB(x, y); int red = (rgb & 0x00ff0000) >> 16; …

Member Avatar
Member Avatar
+0 forum 2

Hey all, I have a JApplet that runs in browser and I can't get it to create a new JFrame popup when a button is clicked. It works fine in my IDE (Eclipse) but not when I upload it. Here's the code for the JFrame I'm trying to create: import java.awt.*; import java.awt.event.*; import javax.swing.*; import org.jdesktop.swingx.*; public class SchedWind { private String selectedDate; private PHPHandler phpMain; private ResponseObj[] serverPHPresponse; private final JLabel hotStatus; public SchedWind() { hotStatus = new JLabel("Waiting for user..."); serverPHPresponse = null; selectedDate = null; phpMain = new PHPHandler(); showGUI(); } public void showGUI() { final …

Member Avatar
Member Avatar
+0 forum 18

Hello, I am having some trouble writing this java GUI. First in the win1, i cannot get the start and exit button to the bottom of the page along with the jlabel into the center. Next for win2 i cannot resize the "go here" button at the bottom of the page. also from win2 i cant get he add button to update the contents of the jlist, ie click add, write in servers name, and have it appear on the list. the code i have comment out in win2 is what i thought i needed, but I cannot get it …

Member Avatar
+0 forum 0

Hello, I have two problems. First, I am trying to have a set background image that displays with two jbuttons on the bottom. My error is that when the back ground image is displayed it hides the buttons (until you mouse over them). Second, I want the buttons on the bottom of the frame. Thanks for any help. import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; import java.util.*; public class Greeting extends JFrame { private JButton startButton; private JButton exitButton; private Image background; public JButton getStartButton() { return startButton; } public JButton getExitButton() { return exitButton; } public Greeting(String title) …

Member Avatar
Member Avatar
+0 forum 2

guys, I need help in swing framework... what method is being used when you have to pressed exit button first before opening other frames? It's like an equivalent of showDialog() from C#.net.

Member Avatar
Member Avatar
+0 forum 4

I'm trying to get my JPanel (JFrame?) to resize itself to fit randomly drawn shapes. I have a shape superclass and right now I'm working with my line subclass. Everything is working fine except I can't figure out how to make the shapes fit the size of the JPanel. Should I limit the size of the shapes or could someone suggest a way to dynamically set the size of the Jpanel based on the maximum size of the shapes? (I'll eventually want to do this with several shape types in the same panel). I'm thinking a for loop grabbing the …

Member Avatar
Member Avatar
+0 forum 3

The End.