Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

image with +- zoom

  Asked By: Arland    Date: Dec 10    Category: Java    Views: 995
  

What is the easiest way to import an image to display in Java. I want
to show an image with +- zoom. I have the frame set and the buttons
in place but can not import the image.

import javax.swing.*;
import java.awt.*;
import java.awt.image.*;


public class Zoom extends JPanel
{
public static void main(String []args)
{
Zoom zoom = new Zoom();
JFrame frame = new JFrame("ShowZoom");

frame.setTitle("Show zoomed image in frame");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(600, 400);
frame.getContentPane().add(zoom,
BorderLayout.CENTER);
frame.setVisible(true);
}


public Zoom()
{
this.setBackground(Color.white);
//this.setFont(new Font("Dialog", Font. Bold, 24));

JPanel p1 = new JPanel();
p1.setBackground(new Color(200, 200, 200));
this.add(p1);
p1.add(new JButton("+"));

JPanel p2 = new JPanel();
p2.setBackground(new Color(200, 200, 200));
p1.add(p2);
p2.add(new JButton("-"));




}
}

Share: 

 

1 Answer Found

 
Answer #1    Answered By: Fdsfe Fsdfdre     Answered On: Mar 04

thank you for giving the codes up here. here i'd like to share with one easy way that is written in javescript. will display and zoom image
http://www.rasteredge.com/solutions/web-viewing/

 
Didn't find what you were looking for? Find more on image with +- zoom Or get search suggestion and latest updates.




Tagged: