59 Topics

Member Avatar for
Member Avatar for dsmush

[SIZE=4][FONT=Arial]Hi, I'm creating an application that makes use of the GridBagLayout as it is the most useful layout manager for what I need. I made a JPanel and added it to the frame. The result I'm currently getting during run-time is a JFrame with a JPanel placed in the center. …

Member Avatar for Toby_6
1
3K
Member Avatar for scheppy

Guys, Im wondering, If I have another class with a jpanel in it... and I add this to the jPanel, this should work correct? jpanel.add(new DoughOverviewList()); jpanel.repaint(); for some reason its not showing in my jpanel, /* * To change this license header, choose License Headers in Project Properties. * …

Member Avatar for scheppy
0
404
Member Avatar for Doogledude123

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); // …

Member Avatar for Doogledude123
0
2K
Member Avatar for Doogledude123

I was wondering if it would be more efficient to render a single BufferedImage instead of rendering a bunch of BufferedImages in a double for loop? I have an idea of how to do it, I just don't know what methods in BufferedImage you would use to create the bigger …

Member Avatar for JamesCherrill
0
285
Member Avatar for Doogledude123

I have a custom class which extends JPanel and overrides the paintComponent() method. Here's what that looks like: @Override protected void paintComponent(Graphics g) { if(redrawRequested) { g.setColor(ETCH_BACKGROUND_COLOR); g.fillRect(0, 0, owner.getAppWidth(), owner.getAppHeight()); redrawRequested = false; } g.setColor(Color.BLACK); g.fillRect(pointX, pointY, PIXEL_SIZE, PIXEL_SIZE); } The same custom class also implements KeyListener. I am …

Member Avatar for JamesCherrill
0
419
Member Avatar for sirlink99

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, …

Member Avatar for JamesCherrill
0
1K
Member Avatar for Doogledude123

I'm painting a grid on the JPanel and trying to scroll the grid with a JScrollPane. I have a feeling the scrollpane is getting the actual size of the panel, instead of the size including what is not being shown. Something along those lines at least, I can't quite wrap …

Member Avatar for mKorbel
0
1K
Member Avatar for CoilFyzx

Hello good day. I have an idea for my program. I have a Table in my display. I want to add a Component to - let's say - the right of my screen. When I click this component it should display to me buttons and other components that I have …

Member Avatar for JamesCherrill
0
528
Member Avatar for 117

Hello, I have worked on a project to make a custom-like Internal Frame. There are also other classes which extends it, instead of JInternalFrame. The project works quite good, but there is a problem. The discription of how the JPanel window works: _______________________________________________________________ There is a main JPanel which contians …

Member Avatar for JamesCherrill
0
279
Member Avatar for ferizhandi

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 …

Member Avatar for JamesCherrill
0
216
Member Avatar for AODfan

Hi all, I am having an issue with getting my Jbuttons and JComboBox alignment properly in the JPanel. I have tried changing the coordinates of the GridLayout around to try to satisfy, but they are working properly. I am trying to get my radio buttons to the far right and …

Member Avatar for chdboy
0
600
Member Avatar for CoilFyzx

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 …

Member Avatar for CoilFyzx
0
387
Member Avatar for Tanio

I have developed a piece of software that creates an embedded graph database. I was wondering whether I can use a special feature to visualize it within my program without opening other tools. I am developing my software in JAVA using eclipse and windows builder. I have heard about some …

0
151
Member Avatar for vaironl

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 …

Member Avatar for vaironl
0
1K
Member Avatar for easyscript

Am trying to draw image on jpanel or jlabel when button is been click on, so i added actionperformed on my button as follows. private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: Image imag = new ImageIcon(this.getClass().getResource("img/top_bg.jpg")).getImage(); showPix1.setLayout(new BorderLayout()); showPix1.add(new paintPhotos(imag,20,20), BorderLayout.CENTER); } I have a …

Member Avatar for mKorbel
0
810
Member Avatar for W1nst0n

Hi guys, i am trying to add a image as the background for my project but cant get my code right, heres what I got so far //beginning of 1 import java.awt.Graphics2D; import java.awt.Toolkit; import java.awt.image.BufferedImage; import javax.swing.JPanel; /** */ public class makeB extends JPanel { private BufferedImage buffer; private …

Member Avatar for mKorbel
0
383
Member Avatar for hwoarang69

i cant seem to print imageicon in board.java. any ideas? i got two files. board.java and WorldBackground.java i have a WorldBackground.java where i am create background image import java.awt.Image; import javax.swing.ImageIcon; public class WorldBackground { static ImageIcon background = new ImageIcon(WorldBackground.class.getResource("Images/backg.jpg")); public static Image getBackground() { return background.getImage(); } } …

Member Avatar for hwoarang69
0
225
Member Avatar for geek86

Hello everyone. 1)I am trying several days now to display an image from file Chooser in Netbeans. i have read and tried many different approaches from the web, but something goes wrong.Although the program runs ok,I see no results.Until now, I have used the "Design" tab of Netbeans to create …

Member Avatar for JamesCherrill
0
3K
Member Avatar for alfredarthur

I want to add squares onto a jpanel one at a time after a delay . My program works fine until I tried to change the background color with setBackgound(). It didn't change. I worked out I have to call super.paintComponent(gr) in my paintComponent method. But when I do this …

Member Avatar for sciwizeh
0
1K
Member Avatar for sid78669

I am working on a project where i need to dynamically count how many buttons need to be added to a certain panel. Each button press has to change a variable in the parent class and then to excute generation of a child panel which also dynamically generates buttons. my …

Member Avatar for NormR1
0
250
Member Avatar for jimoaks

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 …

0
299
Member Avatar for v3ga

I have a JLabel and a JPanel which both implements MouseClicked methods and I have added the JLabel to the JPanel but when the JLabel is clicked, the MouseClicked method of JPanel is invoked. How to fix this>??

Member Avatar for v3ga
0
152
Member Avatar for djescobar

Hi Sorry i was doing a little program and i need helps i would like to something similar to that [url]http://i42.tinypic.com/2mys23d.png[/url] this is my code so far [code] private void makeFrame() { frame = new JFrame("Jubilee Estate Agency Property"); makeMenuBar(frame); Container contentPane = frame.getContentPane(); JLabel label = new JLabel(); contentPane.add(label); …

Member Avatar for djescobar
0
222
Member Avatar for 117

Hello, I'm trying to make a JPanel with JFrame capabilities, such as resizing, and moving, Everything seems to work fine, altough there are minor flickering inside the JPanel, I have numeral repaints and I have a method called update(), which uses absolute position to arrange Containers and Components. Whenever the …

Member Avatar for 117
0
4K
Member Avatar for comSysStudent

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 …

Member Avatar for comSysStudent
0
7K
Member Avatar for phy2sma

I'm having problems adding a JPanel, which has a paintComponent in it, to a JFrame. If this is the only thing I add to the frame, it works. But as soon as I add a layout manager and add other components to the JFrame, it no longer shows the panel …

Member Avatar for JamesCherrill
0
229
Member Avatar for stakeMyHeart

im creating a prototype for a hotel using netbeans ide 7.0. I used the drag and drop in designing the buttons, panels, label etc... then what i want to happen is when the button is clicked a jpanel/ jframe that i did will appear. How would i do that? I …

Member Avatar for stultuske
0
277
Member Avatar for person192

Hi daniwebbers, I am a newbie learning java and keep getting a "cannot find symbol" error when I try to compile my program. I've tried searching but I don't really know what search terms I should be using in this case. Can anyone see the problem? [CODE]import javax.swing.*; import java.awt.event.*; …

Member Avatar for peter_budo
0
216
Member Avatar for abyss776

I've been searching the internet for a way to specify the size of a component within a JPanel, but I haven't been able to find anything that has worked. The best answer I came across was to override the getPreferredSize(), getMaximumSize(), and getMinimumSize() methods of the component, but the component …

Member Avatar for abyss776
0
210
Member Avatar for mhariharasudan

Hi, I am a new Java Programmer.could you help me in resolving this. I am trying to created a JPanel withing a main JPanel. For the nested one, i have included Grid Layout and i am trying to add components to it dynamically. i.e i have added a combo box …

Member Avatar for mhariharasudan
0
1K

The End.