Simply stated, I am trying to make a game I am working on full-screen.
I have the following code I am trying to use:
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice gs = ge.getDefaultScreenDevice();
if(!gs.isFullScreenSupported()) {
System.out.println("full-screen not supported");
}
Frame...
I understand that this may be impossible, but I would sure like to know if somebody has accomplished this, or have a work-around.
I have an SWT Button and am wanting to overwrite an existing JPanel's contents with just the Button being present. My current strategy is to have the SWT Button as an initial null field and then set it throug...
Hi,
I want to maximize a JPanel inside a JFrame when the user clicks a button.What is the best way to achieve this.The view and the data model should be in sync in both the panels,that is the panel which in the JFrame and the maximized one.Please suggest me some solution.
my requirement is: i have a JFrame with 4 JPanels named as
JP...
I am trying to add a JLayeredPane to a JPanel and then add an image (JLabel icon) and a button to the JLayeredPane, but neither show up. I've tested the image without the button and the layeredpane so I know that works. Here is some of the code I am using. Is there something I am missing or doing wrong?
public class MyClass extends...
Ok, I read the Java Documentation and I just can't figure out what is the main difference between those two methods. Sometimes I used setSize(), sometimes setPreferredSize(), sometimes one does what I want, sometimes the other.
So, what is the main difference between the two? Which one should I use for JFrames and JPanels?
Thanks
...
Hi I have created a Jtable and can get it to show on my frame yet not on the JPanel I have ontop of my JFrame. I can't seem to change
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.*;
import java.util.ArrayList;
import java.util.Comparator;
import javax.swing.*;
import javax.s...
i've added a title to my Jframe, and now its blocked everything else, what have I done??
public class addressbook
{
public JFrame frame;
public JButton btnadd, btndelete, btnsave, btnprev, btnnext;
public JPanel panel, pTitle;
public JTextField txtname, txtaddress, txthomeno, txtmobno;
public JLabel JlbName , JlbHtn, JlbMtn, JlbAddress,...
Hi everyone,
I have a problem. I used Gridbaglayout in my JFrame. One of the component is JPanel.
I wanted to draw a gridline as a background for my JPanel. e.g in the program below, it supposed to produce 3 vertical and 3 horizontal lines, however it only shows 2 vertical and 2 horizontal line. the last line was not shown.
Another pro...
Hi Geeks,
I have created JFrame and kept a JPanel in it. Now I have to split the JPanel to a scrollPane and a text Pane. My JPanel size is 1000(W),700(H). I wanted to devide it to scrollpane 700(W),700(H) and 300(W),700(H) textPane areas. But I am not able to do it. The main frame area is devided into two equal parts only. Can anybody h...
With the following code, I want to create a Jpanel generic component and add two sub components, a Label and a JTextField. I am to add the components, but they do not left align.
(No, I don't need GridBagLayout, but I was trying to do a basic example with GridBag. Can you describe how to do this with GridBag and not another layout).
...
Hi,
is there a possibility to draw a JPanel on a specific location op a Graphics (or Graphics2D) object?
I override the paint method of my canvas, and call panel.paint(g) in there, but it does not work the way I woul hope.
@Override
public void paint(Graphics g){
Dimension size = panel.getPreferredSize();
panel.setBounds(pos.x, pos...
Hi everyone,
How can I tell the paint method to draw background on JPanel only and not on the entire JFrame.
My JFrame size is bigger than the JPanel. When I try to paint a grid background for the JPanel, the grid seems to be painted all over the JFrame instead of just the JPanel.
Here parts of the code:
public class Drawing extends ...
Hi all,
Been developing a game for a while, and currently re working the GUI, or at least trying to. Had the massive problem of not being able to resize the frame (without issues), as I didn't understand layout managers very well. A few projects later, and time to come back and do some more on the game, and I hit a problem...
The basic ...
Hello!
Wanted to know - what would you suggest can be a best way to implement that?
Basically, what I need is to place a code which would allow a user to make a double-click on a row in the JTable (double-click part shown below), which is located on JPanel A, and this double-clicking will redirect user to JPanel B, which would contain ...
I'm using a JTabbedPane to hold each step in the wizard that I am building. Navigation between steps is doing using the Previous/Next buttons or by selecting a tab. The buttons decrement/increment the JTabbedPane's SelectedIndex.
I need to validate each step before proceeding to the next step. Essentially, I'm having difficulty deter...
Hi,
I have the following NavigableImagePanel, it is under BSD license and I found it in the web. What I want to do with this panel is as follow:
I want to add a JScrollPane to it in order to show images in their full size and let the users to re-center the image using the small navigation panel. Right now, the panel resize the images ...
Hi,
I need to convert a certain region of an jpanel into a bufferedImage, or other format to be shown in another jpanel.
By now, I only saw codes that converts the whole jpanel into a bufferedImage, but in my case, I need just an area inside an jpanel.
thanks
...
Hi,
In my GUI application, I have several JPanels that are instantiated at various points during the running of my program, and certain actions will cause one of them to be displayed in a scroll pane:
mViewport.setViewportView(currentPanel);
The trouble is, that my panels are done using Grid Bag Layouts, and the behaviour of that is ...
Hello,
I have a JPanel inside a JFrame. I have registered a KeyListener, based on which I want to update the JPanel. The problem I am having is that I cannot get the focus on the JPanel and therefore my KeyListener won't work. I already know that the KeyListener is functional because I registered it with the JFrame and it worked fine. M...
I want to have a JPanel which uses an image as a background, with this I want to add new panels to this panels so that they sit on top of this background image. I have tried the following:
Image background;
public Table(){
super();
ImageIcon ii = new ImageIcon(this.getClass().getResource("pokerTable.png"));
background = ii....