Showing posts with label GUI. Show all posts
Showing posts with label GUI. Show all posts

Tuesday, April 19, 2011

start jFrame in the center of the screen


// Get the size of the screen
    Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
    
    // Determine the new location of the window
    int w = window.getSize().width;
    int h = window.getSize().height;
    int x = (dim.width-w)/2;
    int y = (dim.height-h)/2;
    
    // Move the window
    window.setLocation(x, y);

Wednesday, December 29, 2010

Start X from shell, Ubuntu

First method, Use init script
sudo /etc/init.d/gdm start
sudo /etc/init.d/kdm start

Second method, type startx command :
startx

If nothing works, type xinit to star X server without KDE:
xinit

Now start kde with following :
startkde

Saturday, August 29, 2009

quickly resize or rotate images within nautilus

If you are looking for a way to batch resize many pictures at the same time with just 2 easy steps, you have found the right tutorial. I found a way by blogging on Internet to add resize and rotate option to your right click and have it always there right beside your hand ;-)

Installation

To add this functionality we’ll need to install the nautilus-image-converter package:

#sudo aptitude install nautilus-image-converter

Use

Before you’re able to use this functionality you’ll need to restart nautilus or simply logout and back in. You’ll now be able to right-click on any image on your machine and you’ll see two new menu items:

"resize images"

"rotate images"

Check out the screen shots down here ...
You can also choose to resize by percentage or by exact dimension.

Source : Modifed but direct tutorial from Ubuntu Tutorials Dapper

Tuesday, April 07, 2009

make a frame NOT resizable in JAVA ...

This program illustrates you how to make a frame non resizable. It means, disabling the maximize button of the frame.

The setResizable() method has been used to make the frame resizable or not. If you pass the boolean value false to the setResizable() method then the frame will be non-resizable otherwise frame will be resizable. The setResizable() is the method of the JFrame class which takes a boolean valued argument (true or false).

Screen shot for the result of the program:

Non Resizable Frame.

Here is the code of the program :

import javax.swing.*;

public class SwingFrameNonResizable{
public static void main(String[] args){
JFrame frame = new JFrame("Non Resizable Frame");
frame.setResizable(false);
frame.setSize(400, 400);
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}

Friday, March 27, 2009

GUI differences in Windows and Linux

Taking a cue from the Macintosh design concept, Windows developers integrated the GUI with the core operating system. One simply does not exist without the other. The benefit with this tight coupling of the OS and user interface is consistency in the appearance of the system.
On the other hand, Linux(like UNIX in general) has kept the two elements-user interface and OS- separate. The X Windows system interface is run as a user-level application, which makes it more stable. If the GUI fails Linux core does not go down with it. The process simply crashes and you get a terminal window. The X Window System also differs from the Windows GUI in that it isn't a complete user interface. It only defines how basic objects should be drawn and manipulated on the screen. The most significant ability of X Windows System is that they can operate through network on other workstation's screens.

source : Linux Administration, A beginners guide, 5th edition (2009)