Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

How to change resoultion ?

  Asked By: Bill    Date: Jan 06    Category: Java    Views: 572

Will u please tell me how to genrate reports using java
and i face one problem i created some frame on my m/c it take my monitor resolution but when i run same program on other m/c which have different monitor it may required change resoultion of my program each time, there are any code which set resoultion automatically for different m/c.



2 Answers Found

Answer #1    Answered By: Sheryl Morgan     Answered On: Jan 06

you should use CrystalReport 10 or above for Java Reporting that adaptive for java and some approach of your problem  is:

here's the code  that sets the display mode

GraphicsDevice dev = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
GraphicsConfiguration gc = dev.getDefaultConfiguration();
DisplayMode mode = new DisplayMode(800, 600, 32, DisplayMode.REFRESH_RATE_UNKNOWN);
JFrame frame  = new JFrame(gc);

frame.getContentPane().add(new MainPanel(), BorderLayout.CENTER);

if(dev.isDisplayChangeSupported()) dev.setDisplayMode(mode);

Answer #2    Answered By: Brian Ross     Answered On: Jan 06

another way is :
adaptive your frame  with screen resolution.

private Dimension dim;

private void resolutionAdapter() {

dim = Toolkit.getDefaultToolkit().getScreenSize();
screenWidth = (int) dim.getWidth() - 200;
screenHeight = (int) dim.getHeight() - 200;

Didn't find what you were looking for? Find more on How to change resoultion ? Or get search suggestion and latest updates.