Professional Documents
Culture Documents
*;
import java.awt.event.*;
import javax.swing.*;
7,71,121,-30,-58,-115,94,105,118,80,42,82,-84,-86,-68,30,40,-56,31,109,
getScreen();
setMagnifierSize(magnifierSize);
91,-11,-37,-20,105,115,48,53,10,0,59
};
}
import java.awt.*;
import java.awt.event.*;
this.locationX = locationX;
import javax.swing.*;
this.locationY = locationY;
import javax.swing.event.*;
import java.awt.geom.*;
updateMagnifierPicture();
}
this.screenImage = screenImage;
updateMagnifierPicture();
}
circle3.intersect(circle4);
brightGlassColor = new
Color(140,140,140,50);
darkGlassColor = new
Color(100,100,100,50);
lightInGlassColor = new
Color(255,255,255,100);
setPreferredSize(new
Dimension(magnifierSize,magnifierSize));
if (getParent() != null)
getParent().repaint();
updateMagnifierPicture();
locationX,
import javax.swing.event.*;
locationY,
import java.io.*;
locationX+magnifierSize,
locationY+magnifierSize,
this);
g.setClip(circle5);
g.drawImage(screenImage,
0,
0,
magnifierSize,
magnifierSize,
locationX+(magnifierSize/4),
locationY+(magnifierSize/4),
locationX+(magnifierSize/4*3),
locationY+(magnifierSize/4*3),
this);
g.setColor(darkGlassColor);
g.fill(circle1);
g.setColor(brightGlassColor);
g.fill(circle3);
g.setColor(lightInGlassColor);
g.fillOval((magnifierSize/5),
(magnifierSize/5),(magnifierSize/10),
(magnifierSize/10));
}
}
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public MagnifierWindow(String
windowTitle){
super(windowTitle);
magnifierIcon = new
ImageIcon(MagnifierIcon.magnifierIcon).getI
mage();
setIconImage(magnifierIcon);
setUndecorated(true);
container.add(magnifierPanel);
addMouseListener(new
MouseFunctions());
addMouseMotionListener(new
MouseMotionFunctions());
timeUpdate.start();
menuRefresh.addActionListener(
new ActionListener(){
public void
actionPerformed(ActionEvent e){
updateScreen();
}
}
);
menuHide.addActionListener(
new ActionListener(){
public void
actionPerformed(ActionEvent e){
setState(JFrame.ICONIFIED);
);
menu100Pixels.addActionListener(
new ActionListener(){
public void
actionPerformed(ActionEvent e){
magnifierSize = 100;
updateSize(magnifierSize);
}
}
jOptionPane.showMessageDialog(null,
);
jTextArea,
menu200Pixels.addActionListener(
new ActionListener(){
public void
actionPerformed(ActionEvent e){
magnifierSize = 200;
updateSize(magnifierSize);
}
}
);
menuHow.addActionListener(
new ActionListener(){
"How to use
magnifier",
JOptionPane.INFORMATION_MESSAGE);
}
}
);
menuSite.addActionListener(
new ActionListener(){
public void
actionPerformed(ActionEvent e){
public void
actionPerformed(ActionEvent e){
jTextField.setText("http://softcollection.sytes.
net/javaprog");
jOptionPane.showMessageDialog(null,
jTextField,
popupMenu.add(menuHelp);
site!",
menuHelp.add(menuHow);
menuHelp.add(menuSite);
JOptionPane.INFORMATION_MESSAGE);
menuHelp.add(menuAbout);
popupMenu.add(menuExit);
}
);
updateSize(magnifierSize);
menuAbout.addActionListener(
openFile();
new ActionListener(){
public void
actionPerformed(ActionEvent e){
JOptionPane.showMessageDialog(null,"Ma
gnifier
v1.14","About",JOptionPane.INFORMATIO
N_MESSAGE);
show();
}
}
}
setSize(magnifierSize,magnifierSize);
);
validate();
menuExit.addActionListener(
new ActionListener(){
public void
actionPerformed(ActionEvent e){
System.exit(0);
}
try{Thread.sleep(updateScreenDelay);}
catch(InterruptedException e){}
magnifierPanel.getScreen();
);
popupMenu.add(menuRefresh);
show();
}
popupMenu.add(menuHide);
popupMenu.add(menuSize);
menuSize.add(menu100Pixels);
menuSize.add(menu200Pixels);
if (magnifierStopped == false){
setCoordinateX +=
onScreenMoveDidectionX;
setCoordinateY +=
onScreenMoveDidectionY;
if (setCoordinateX < 0)
onScreenMoveDidectionX =
onScreenMoveDidectionUp;
if (setCoordinateY < 0)
onScreenMoveDidectionY =
onScreenMoveDidectionUp;
if (setCoordinateX > (screenWidthmagnifierSize)) onScreenMoveDidectionX =
onScreenMoveDidectionDown;
mousePressedNow = true;
relativeCoordinateXWhenMousePressed=e.
getX();
relativeCoordinateYWhenMousePressed=e.
getY();
magnifierStopped = true;
}
if
(e.getButton()==MouseEvent.BUTTON1&&
e.getClickCount()==2){
magnifierStopped = false;
}
}
public void mouseReleased(MouseEvent
e){
mousePressedNow = false;
saveFile();
setLocation(setCoordinateX,setCoordinateY
);
if (e.isPopupTrigger()){
}
try{Thread.sleep(timeUpdateDelay);}
catch(InterruptedException e){}
popupMenu.show(e.getComponent(),e.getX
(),e.getY());
}
}
}
}
}
absoluteCoordinateX =
MagnifierWindow.this.getLocationOnScreen
().x + e.getX();
}
catch(IOException e){}
absoluteCoordinateY =
MagnifierWindow.this.getLocationOnScreen
().y + e.getY();
setCoordinateX =
absoluteCoordinateXrelativeCoordinateXWhenMousePressed;
setCoordinateY =
absoluteCoordinateYrelativeCoordinateYWhenMousePressed;
magnifierPanel.setMagnifierLocation(setCo
ordinateX,setCoordinateY);
setLocation(setCoordinateX,setCoordinateY
);
}
}
ObjectInputStream in;
try{
in = new ObjectInputStream(new
FileInputStream("Magnifier.cfg"));
try{
configData =
(ConfigData)in.readObject();
setCoordinateX =
configData.magnifierXCoordinate;
setCoordinateY =
configData.magnifierYCoordinate;
magnifierSize =
configData.magnifierSizeInPixels;
updateSize(magnifierSize);
public void saveFile(){
ObjectOutputStream out;
catch(ClassNotFoundException e){}
configData.magnifierXCoordinate =
getLocation().x;
catch(IOException e){}
in.close();
configData.magnifierYCoordinate =
getLocation().y;
}
catch(IOException e){}
configData.magnifierSizeInPixels =
magnifierSize;
try{
}
}
out.flush();
out.close();