Swing/AWT/SWT :: Screen Resolution / Size

Sep 29, 2014

I have created a java gui on Windows 7 with Eclipse EE, using a screen resolution of 1366 x 768. I used groups with specified boundaries. For example:

final Group g5_script_data = new Group(shell, SWT.BORDER_SOLID);
g5_script_data.setText("Current DB");
g5_script_data.setBounds(0, 0, 680, 380);
g5_script_data.setBackground(green);

The groups cover the whole screen.

However my colleague with a smaller resolution looses the far right of the screen.

As this is a proto-type and I'm new to Java I don't want to rework everything or convert it to say a grid layout until the proto-type is accepted and I can start from scratch with a real detailed design. It already has 6500 lines of source.

Just wondered what is my quickest/easiest way to get my app to display on a slightly smaller resolution. For sure it will not be anything silly. Something like 1280 x 768 to 1366 x 768 would do.

View Replies


ADVERTISEMENT

Swing/AWT/SWT :: Resize Application Depending On Screen Resolution

Sep 26, 2014

I developed a swing application using group layout. It resizes when I resize the frame but when I change the screen resolution or when I run the application in a laptop which has small sized screen, the components over lap each other. I need my application to fit according to the screen resolution

The code is as follows

private void initComponents() {
jComboBox1 = new javax.swing.JComboBox();
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();

[Code]...

According to the list item selected, an internal frame will appear in the desktop pane. I use group layout for that internal frame too.

View Replies View Related

Swing/AWT/SWT :: Screen Resolution - Components Adjustment And Alignment

Mar 30, 2015

I'm working on Ubuntu with resolution 1600*900; I used MigLayout to place the components of the application; but when I go with higher resolutions,components adjustment and alignment are not up to the mark.

View Replies View Related

Scaling Text According To Screen Size

Jul 4, 2014

What I am creating is a clock. That goes round n round using "getcalendar". It's realtime, but the clock has a constant resolution of 800x800. I have carefully placed numbers from 1-12 on the clock using that resolution placing them pixel by pixel. Now if I resize the window, the clock resizes but the text, it fades away out of the screen because the resolution is too small.

This is how I draw them.

g2.drawString(six, 380, 750);
g2.drawString(twelve, 375, 70);
g2.drawString(nine, 30, 415);
g2.drawString(three, 725, 415);
g2.drawString(one, 570, 120);
g2.drawString(two, 690, 250);
g2.drawString(four, 685, 575);
g2.drawString(five, 570, 700);
g2.drawString(seven, 200, 710);
g2.drawString(eight, 80, 585);
g2.drawString(ten, 80, 235);
g2.drawString(eleven, 205, 115);

I understand why this is happening, obviously because the strings are in a certain place just can't understand how do I make them scaleable? Is there an universal formula? Or do I have to draw every string relevant to some mathematical equation regarding to the screen size.

For example : g2.drawString(twelve, diameter / 2, screenheight / 3);

View Replies View Related

Size Of Frame In Gaming Code - Full Screen Mode

Feb 17, 2014

Basically the code is for a game which is displayed in a window. The statement if(false) //full screen mode is confusing me a little. How does this if work? it doesn't seem to be testing for anything so how does it ever get set to full screen mode? Is the if even needed? why not just code windowed mode?

public class Window extends JFrame{
private Window()
{
// Sets the title for this frame.
this.setTitle("My test");
// Sets size of the frame.
if(false) // Full screen mode

[Code] .....

View Replies View Related

JavaFX 2.0 :: HTMLEditor - Default Size / Cannot Fill Full Screen

May 10, 2015

The code:
 
import javafx.application.Application;
import javafx.collections.FXCollections;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.layout.BorderPane;

[Code] ....
 
run (when window height > 700px ) :
 
HTMLEditor  default height is 670px, the other area (green color) is not filled,why?
 
HTMLEditor   高度总是670px, 怎么把HTMLEditor 填充满窗口?
 
这是一个bug吗?

is it bug?

View Replies View Related

Swing/AWT/SWT :: How To Make GUI Look The Same On All Screen Resolutions

Feb 11, 2015

I had developed small GUI using swing group layout, which is nice to see on windows, but when I tried it on Linux the GUI look is varied. Then I set the GUI height and width by taking screen resolution, still it is varies the screen look. How I can make the GUI such that it looks the same on all screen resolutions.

View Replies View Related

Swing/AWT/SWT :: How To Update The Table On Screen

Mar 11, 2014

I'm writing my first bigger program (mysql connection and the first thing bigger than 300 lines ). What I'd like to do is to render data from MySQL using JTable - I managed to handle all the queries but I don't know how to update the table on screen. I've tried to use repaint() but nothing happened. I'm not posting whole code because you'll probably not interested, below are the most important things. I thought about using TableModel but how.

public class Main implements ActionListener{
JTable table;

public Main() {
JFrame frame = new JFrame("Frame");
frame.setLayout(new FlowLayout());
frame.add(table);

[code]...

View Replies View Related

Swing/AWT/SWT :: Dragging Window Downwards - Screen Alignment?

Oct 29, 2014

I am trying to drag the window down wards and screen has alignment issues. I tried to use WindowListeners, Component Listeners, MouseListeners ect…

But still this problem persists as only I release the mouse after drag down it appears fine that we have handled ComponentResized() method. So how to restrict component size while keep dragging down?

View Replies View Related

Swing/AWT/SWT :: Redrawing Images Causes Flickering On Screen

Mar 12, 2014

i'm currently doing my system now and my problem is about inserting an image to my jframe form with thread because if i insert image and when i run it it blinks too slow comparing if i use simple oval it doesnt blink.

why is it that if i wrote the code like this.

public void DrawSnake(Graphics g) throws IOException {
Image image = ImageIO.read(this.getClass().getResource("body1.jpg"));
Image image1 = ImageIO.read(this.getClass().getResource("body.jpg"));
Image headr = ImageIO.read(this.getClass().getResource("headr.jpg"));
Image headl = ImageIO.read(this.getClass().getResource("headl.jpg"));

[Code] .....

View Replies View Related

Swing/AWT/SWT :: Print Preview On Screen For JTable

Apr 9, 2014

I want to build a class that takes a JTable and previews on screen how it will be printed on the default printer. This is what we use to call as "Print Preview", just like MS Word, Excel, etc. As we already know Java does not support this functionality out-of-the-box.

Based on some examples I've found googling I built two classes. The first one TestPreview.java justs shows the JTable and the second one PrintPreview.java previews how the JTable will be printed on the printer.

I have two buttons to go through the pages, "PREV" and "NEXT" and "Print' button to print the JTable. My problem is that when my JTable has too many rows and spans in more than one page PrintPreview does not work. It shows the same page again and again. Also, it does not show the entire JTable data, but only some of them and I can't figure out why.

Below is my two classes.

TestPreview.java
package printpreviewdemo;
import javax.swing.*;
import java.awt.BorderLayout;
import java.awt.FlowLayout;

[Code] ....

Below are my screenshots.

View Replies View Related

Swing/AWT/SWT :: Making Ball Bounce Around A Screen

Aug 12, 2014

I've got to make a ball bounce around a screen.... From what I can gather they seem to hold back useful java code.

anyway, i've changed the code over and over, and think this is the most succinct way i can manage it. but i have a problem. where i've marked the code (*****) and the following line are conditional on each other. so one won't provide the correct answer without the other line executing first, and vice versa (ignore the code after, i haven't looked at where that should be yet ). Anyway I don't really want to rip the code apart, again, because i'm pretty sure it's close.

View Replies View Related

Swing/AWT/SWT :: Setting Size Of JFrame

May 26, 2014

I am rather new to Swing, and I am building a game right now in which I need to display a pop-up window as a reminder for what commands exist within the game. I created a class extending JFrame for this and added all the information I need. However, for some reason, no matter how many different ways I try to set the size of this window (setSize(w, h), pack(), using a different layout, adding the compnents to a JPanel first and setting the preffered size of that, then adding the JPanel to the JFrame), it doesn't work. Instead of a window of my requested size, I get a tiny, maybe 100 x 100 pixel window that needs to be resized in order for its contents to be visible.

import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.Toolkit;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

[code]....

View Replies View Related

Swing/AWT/SWT :: Adjusting Size Of Box With Mouse

Oct 16, 2014

I'm running the code below which compiles ok using latest version of Java and on Sublime. The problem when it complies the output screen is blank and I can only see the text by adjusting the size of the box with my mouse - and then it colours in black. Code and screenshot below. Is there something wrong with the paint/graf part of the code?

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class BackArray extends JFrame {
int store[] = {2,6,4,8,34,67,19,99,10,12,89,68,45,37};
int xcoord = 100;
boolean firsttime=true;

[code]....

View Replies View Related

Swing/AWT/SWT :: Change Size Of Entire GUI?

Feb 4, 2015

I built a GUI and after testing it on various platforms I think I would like to make it bigger by a factor of 2.2 or so.

Is there an easy way to just enter the factor 2.2 and have the GUI change by that factor?

I have over 50 components in the GUI. Ideally each one would just enlarge by the factor including the fonts.

This was my first (and only so far) java program. I didn't know anything about layout managers. I used netbeans and it generated all the code.

View Replies View Related

Swing/AWT/SWT :: How To Change JFrame Size

Jan 14, 2015

import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

[Code].....

View Replies View Related

Swing/AWT/SWT :: JTextArea Position And Size

Nov 6, 2014

I need to make a simple applet, but I'm stuck with something. This is how my applet should look:

And this is how that part looks in my applet:

What I've done until now is create one JPanel which includes two other JPanels.. The first one contains only the JTextArea you can see, and the other one includes the other elements.

I just need to make the JTextArea taller, like in the example, so everything comes into place...

View Replies View Related

Swing/AWT/SWT :: Want To Maximize JFrame Size

Apr 13, 2014

I have a simple application where I display a JFrame. I want to maximize the JFrame size, so I have the code this.setExtendedState(MAXIMIZED_BOTH); in the constructor. How do I find the dimensions of this JFrame in its extended state though? I tried this.getSize().Height , this getSize().getHeight() and this.getHeight()? None of them work because they just return a value of 0. And what is the difference in all these statements in terms of what they do?

View Replies View Related

Unable To Full Screen Swing Form On Fedora

Jul 16, 2014

I want to make swing form full screen even on taskbar on linux machine. But after trying so hard unable to achieve it. I am using fedora as operationg system.

Below i am giving you my swing code. but whenever i run this file form comes up on the screen and waits for a second and it goes in background.

I am using linux OS Fedora 64 bit.

public class ThankYou {
JFrame f;
JTextArea nameField;
JLabel lable;
String str;

[Code] ....

View Replies View Related

How To Change Fonts And Font Size In Swing

Feb 10, 2014

So, I have a game. I would like to make a game where you press "start" and THEN it starts. Also, I want to have collision with triangles, not just squares. The way I handle collision right now is with if statements, if the object is within the other, game over.How would I do collision with triangles? Lastly, how do I set a high score? how to change fonts and font size in swing?

View Replies View Related

Cardlayout Format - Change Main Menu Screen Into Game Screen On Button Click

Mar 16, 2015

I'm making a game of checkers for my A2 Computing coursework which is due in within a week. I have completely finished the game, and only thing I have left to do is connect the two JPanels together via a CardLayout that I have made. However I am unsure how to do so

Here is the code from my CardLayout:

import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import javax.swing.JButton;

[Code] ....

I have kept the code I am displaying to a minimal, hence I have removed all the action listeners for my buttons, anyway the problem I have is that, I would like it so that when the user clicks on the 'Multiplayer' button which is the array button ourButtons[1], it will then transition into my main game screen so that the user can then play a game of checkers.

Here is the main important GUI from my CheckerBoard class:

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
  public class CheckerBoard extends JPanel implements ActionListener, MouseListener {
// Main routine that opens an Applet that shows a CheckerBoard
public static void main(String[] args) {
new CLayout();
 
[Code] ....

Once again kept to a minimal.

View Replies View Related

Swing/AWT/SWT :: Getting Icons To Change Size With Window Resize

Jan 19, 2014

I'm using a jpanel with an 8 by 8 grid layout of jlabels to which I'm adding images to represent a chess board. At first, I was using the ImageIcon class to initialize my icons, but as soon as I added these icons to the labels, the labels no longer changed size with the window (which I want to happen). URL...

So I copied in the class, and initialized a different set of icons using the stretch icon class (specifically, the method that allows you to initialize a stretch icon from a filename), however, when I use these stretch icons, the result is the same. Is something wrong with the class, or with my implimentation of it, and how would I fix this?

View Replies View Related

Swing/AWT/SWT :: JTextField Size Changes With JLabel Text Length

Nov 11, 2014

I want to create 3 JTextFields in a row with all being of equal size.But my first Text field gets so wide than the other two.After adding each component at a time and seeing what causes the problem I realized that if I type a long text for the JLabel that's when this problem occurs.If I reduce the length of the text in the JLabel JTextFields get into the sizes I want. Here's my code

import java.awt.*;
import java.awt.event.*;
import java.lang.Math;
public class Calculator1 extends JFrame {
JTextField value1=new JTextField("0");
JTextField value2=new JTextField("0");

[Code] ....

How can I stop the JTextFields changing size when I change the JLabel label1's text length...

View Replies View Related

Swing/AWT/SWT :: Getting Icons To Change Size With Window Resize?

Jan 16, 2014

I'm using a jpanel with an 8 by 8 grid layout of jlabels to which I'm adding images to represent a chess board. At first, I was using the ImageIcon class to initialize my icons, but as soon as I added these icons to the labels, the labels no longer changed size with the window (which I want to happen). Someone suggested to me to use this custom stretch icon class, found here:

[URL] ....

So I copied in the class, and initialized a different set of icons using the stretch icon class (specifically, the method that allows you to initialize a stretch icon from a filename), however, when I use these stretch icons, the result is the same. Is something wrong with the class, or with my implementation of it, and how would I fix this?

View Replies View Related

Swing/AWT/SWT :: Jscrollpane Not Shown Until Adjust Window Size With Mouse?

Nov 16, 2014

So for a test i have a small array set as a jlist which is the contents of my jscrollpane, and it appears as if nothing is there until i adjust the window size by dragging it out or in... whats going on?

Here is the full code

import java.awt.BorderLayout;
import java.awt.ComponentOrientation;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;

[Code] ...

View Replies View Related

Swing/AWT/SWT :: Mini Paint Program - Changing Size Of Shapes

Jun 4, 2014

I am currently writing a small drawing program and I am having trouble with changing the size of the shapes. To do this, I have to access the arraylist shapes, check whether pressedX/pressedY is on any of the shapes in the arraylist using the findShape() method and then when released, uses moveBy() in the Rectangle/Oval/Line class and moveShape() in the miniDraw class to move the shape and draw it in the newreleasedX/releasedY position.

So far I think I have pin pointed the problem to being the method in all the shapes classes, that checks whether the pressedX/pressedY which is the on() method, and the findShape() method in the miniDraw class.

This is the minidraw class

import ecs100.*;
import java.awt.Color;
import java.io.*;
import java.util.*;
import javax.swing.JColorChooser;

[Code] .....

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved