SAVE POSITIONS OF THE COMPONENTS!!! HELP!!!
HI!!!
I don't understand!!!
I insert images in JLayeredPane, I move this images, BUT when i press a button (invoke ActioListener) the images become in initial position!!!
HELP ME!!!!!!!
Don't clutter the forum by posting the [url
http://forum.java.sun.com/thread.jspa?threadID=573772]
same question three times.Why did you change your userid from this [url
http://forum.java.sun.com/thread.jspa?threadID=573384]
posting. If you are not the same person then
you are both working on the same assignment and
should get together to solve your problem.
When I replied to the above posting I tried to
explain what the problem was. If you didn't
understand the explanation they ask a follow up
question. Creating a new posting does not allow for
continuity of the problem. New people reading this
posting don't know what has already been suggested.
Maybe myself or someone else will explain it better.
I also asked you to:
a) post a "small" example showing your problem. 200
lines of code is not small.
b) use the code tags when posting code. You couldn't
even manage to do that.
Have you read the code from the Swing tutorial on
[url
http://java.sun.com/docs/books/tutorial/uiswing/compon
ents/layeredpane.html]Using Layered Panes for
an example of this type of behaviour?
A bit off topic but I have to say I truly admire your patience.
Similar Messages
-
HELP!!! save position of the components!!!
Hi!
I have a JLayeredPane where I insert some images. I move this images. BUT when I press a button (that invoke a ActionListener) all the images return at initial position!!!
THE PROGRAM:
import java.io.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.util.*;
import javax.swing.text.*; //per StyledDocument
import javax.swing.BorderFactory;
import javax.imageio.*;
public class mio implements ActionListener,MouseMotionListener,MouseListener{
JTextArea statusInfo; //info da passare a PROGRAMMA TODO
JTextArea PASpar; // PARAMETRI X TODO
JTextArea PASimage; //IMMAGINI X TODO
Color whitex = new Color(255,255,255);
Color bluex = new Color(100,105,170);
Color bluexx = new Color(100,150,170);
Color redx = new Color(255,0,0);
JFrame frame; //contiene tutto
JFrame frameP;
JMenuBar menu;
JMenu fileMenu;
JMenuItem nuovo;
JMenuItem apriimgf;
JMenuItem aprimosf;
JMenuItem salva;
JMenuItem stampa;
JMenuItem esci;
JMenu modMenu;
JMenuItem annulla;
JMenu helpMenu;
JMenuItem help;
JPanel panel; //contiene oggetti entro menu
JPanel panel2;
JPanel panel3; //xbottoni
JLayeredPane pane;
JTextArea spiega;
JTextArea dico2;
JLayeredPane panelpane; //dove carico img
JButton apriimg;
JButton chiudi;
JButton aprimos;
JButton ok;
JButton mosaica;
JButton superR;
JButton salvab;
JButton migliora;
JButton nuovob;
int _dragFromX = 0; // pressed this far inside ball's
int _dragFromY = 0;
boolean _canDrag = false;
int i;
int px;
int py;
int mousex;
int mousey;
int rifno;//x img d riferimento
int scelta; //1 = immagini 2=mosaico
int Nimg; // NUMERO IMG KE INSERISCO <= 12
JLabel image;
ImageIcon icon;
int ximg, yimg; //posizione img in panel
int xgrid,ygrid; //griglia panel
int[] ximgs,yimgs; //x,y img
JLabel[] images;
int hicon,wicon; //h w img
int[] wimgs,himgs;
int muovi; //img da muovere nell'array
public final static int ONE_SECOND = 500; ////
private JProgressBar progressBar;
private javax.swing.Timer timer;
private JButton startButton;
private LongTask task;
private JTextArea taskOutput;
static private String newline = "\n";
// =================== MAIN
public static void main(String[] args) {
//Schedule a job for the event-dispatching thread:
//creating and showing this application's GUI.
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
mio m = new mio();
/*public static void main(String argv[]){
mio m = new mio();
// ================ COSTRUTTORE
public mio(){
rifno = 0;//no img d rif
Nimg = 0;
frame = new JFrame("interfaccia");
PASpar = new JTextArea();
PASimage = new JTextArea();
menu = new JMenuBar();
menu.setOpaque(true);
menu.setBackground(bluex);
// ********* Menu file *********
fileMenu = new JMenu("File");
fileMenu.setMnemonic(KeyEvent.VK_F);
nuovo = new JMenuItem("Nuovo");
nuovo.setMnemonic(KeyEvent.VK_N);
apriimgf = new JMenuItem("Apri immagini");
apriimgf.setAccelerator(KeyStroke.getKeyStroke(
KeyEvent.VK_1, ActionEvent.ALT_MASK)); //alt+1
aprimosf = new JMenuItem("Apri mosaico");
salva = new JMenuItem("Salva");
salva.setMnemonic(KeyEvent.VK_S);
esci = new JMenuItem("Esci");
esci.setMnemonic(KeyEvent.VK_E);
//********* Menu Modifica ***********
modMenu = new JMenu("Modifica");
modMenu.setMnemonic(KeyEvent.VK_M);
annulla = new JMenuItem("Annulla");
annulla.setMnemonic(KeyEvent.VK_A);
// ********* Help Menu *************
helpMenu = new JMenu("HELP");
help = new JMenuItem("Help");
menu.add(fileMenu);
fileMenu.add(nuovo);
fileMenu.add(apriimgf);
fileMenu.add(aprimosf);
fileMenu.add(salva);
fileMenu.addSeparator();
fileMenu.addSeparator();
fileMenu.add(esci);
menu.add(modMenu);
modMenu.add(annulla);
menu.add(helpMenu);
helpMenu.add(help);
// ActionListener x ogni voce d menu
nuovo.addActionListener(this);
apriimgf.addActionListener(this);
aprimosf.addActionListener(this);
salva.addActionListener(this);
esci.addActionListener(this);
annulla.addActionListener(this);
help.addActionListener(this);
frame.setJMenuBar(menu);//in frame menu
panel=new JPanel(new BorderLayout(2,2));
frame.getContentPane().add(panel);
spiega = new JTextArea(" 1. Aprire TUTTE le immagini da mosaicare"+ newline +" Oppure il mosaico da migliorare"+newline,3,40);
spiega.setEditable(false);
spiega.setBorder(BorderFactory.createLineBorder(Color.black));//bordo
spiega.setBackground(bluex);
panelpane = new JLayeredPane();
panelpane.setPreferredSize(new Dimension(900,550));
panelpane.setBackground(whitex);
panelpane.setLayout(new GridLayout(0,4)); //max 12 img e occupano tutto subito
panelpane.setBorder(BorderFactory.createLineBorder(Color.black));
panelpane.addMouseListener(this);
panelpane.addMouseMotionListener(this);
xgrid = 225;
ygrid =183;
ximg = 0;
yimg = 0;
images = new JLabel[12];//immagini
ximgs = new int[12];
yimgs = new int[12];
wimgs = new int[12];
himgs = new int[12];
panel3= new JPanel();
panel3.setBackground(bluex);
panel3.setLayout(new BoxLayout(panel3, BoxLayout.Y_AXIS));
panel3.setBorder(BorderFactory.createLineBorder(Color.black));
chiudi = new JButton("Chiudi applicazione");
chiudi.addActionListener(this);
chiudi.setBackground(bluex);
// ******* 1 FRAME
apriimg = new JButton("Apri immagine");
apriimg.addActionListener(this);
apriimg.setBackground(bluex);
aprimos = new JButton("Apri mosaico");
aprimos.addActionListener(this);
aprimos.setBackground(bluex);
ok = new JButton("Prosegui");
ok.addActionListener(this);
ok.setBackground(bluex);
ok.setEnabled(false); //disabilito
//****** 2 frame
mosaica = new JButton(" Mosaica ");
mosaica.addActionListener(this);
mosaica.setBackground(bluex);
mosaica.setVisible(false);
superR = new JButton("Super-Risoluzione");
superR.addActionListener(this);
superR.setBackground(bluex);
superR.setVisible(false);
// ********* 3 frame
salvab = new JButton(" Salva mosaico ");
salvab.addActionListener(this);
salvab.setBackground(bluex);
salvab.setVisible(false);
migliora = new JButton(" Migliora mosaico ");
migliora.addActionListener(this);
migliora.setBackground(bluex);
migliora.setVisible(false);
nuovob = new JButton(" Nuovo progetto ");
nuovob.addActionListener(this);
nuovob.setBackground(bluex);
nuovob.setVisible(false);
statusInfo = new JTextArea(3,40);
statusInfo.setBorder(BorderFactory.createLineBorder(Color.black));
statusInfo.setBackground(bluex);
JScrollPane scrollArea = new JScrollPane(statusInfo);
panel.add((spiega), BorderLayout.NORTH);
panel.add((panelpane), BorderLayout.CENTER);
panel.add((panel3), BorderLayout.EAST);
panel.add((scrollArea), BorderLayout.SOUTH);
panel3.add(apriimg);
panel3.add(salvab);//3 frame
panel3.add(new JSeparator(JSeparator.HORIZONTAL));
panel3.add(aprimos);
panel3.add(mosaica); // 2 frame
panel3.add(migliora);
panel3.add(new JSeparator(JSeparator.HORIZONTAL));
panel3.add(ok);
panel3.add(superR); // 2 frame
panel3.add(nuovob); // 3 frame
panel3.add(new JSeparator(JSeparator.HORIZONTAL));
panel3.add(chiudi);
frame.pack();
frame.setVisible(true);
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}// chiude costruttore
// ================ metti mosaico
public void mettiMosaico(){
panelpane.removeAll();
ImageIcon img1 = new ImageIcon("mosaico.jpg");
Image imgesize1 = resize2Icon("mosaico.jpg"); // resize
img1 = new ImageIcon(imgesize1);
JLabel image1 = new JLabel(img1);
image1.setLocation(200,10);
panelpane.add(image1);
panelpane.repaint();
// ================= RESIZE MOSAICO
public Image resize2Icon(String image){
Image img;
Image inImage = new ImageIcon(image).getImage();
int maxDim = 500;
double scale = (double) maxDim / (double) inImage.getHeight(null);
if (inImage.getWidth(null) > inImage.getHeight(null))
scale = (double) maxDim / (double) inImage.getWidth(null);
// Determine size of new image.
//One of them
// should equal maxDim.
int scaledW = (int) (scale * inImage.getWidth(null));
int scaledH = (int) (scale * inImage.getHeight(null));
System.out.println(">> "
+ inImage.getSource().getClass()
+ " aspect ratio = "
+ scaledW + " , " + scaledH);
img = inImage.getScaledInstance(scaledW , scaledH, Image.SCALE_SMOOTH);
return img;
// ================= RESIZE IMAGES
public Image resizeIcon(String image){
Image img;
Image inImage = new ImageIcon(image).getImage();
int maxDim = 180;
double scale = (double) maxDim / (double) inImage.getHeight(null);
if (inImage.getWidth(null) > inImage.getHeight(null))
scale = (double) maxDim / (double) inImage.getWidth(null);
// Determine size of new image.
//One of them
// should equal maxDim.
int scaledW = (int) (scale * inImage.getWidth(null));
int scaledH = (int) (scale * inImage.getHeight(null));
System.out.println(">> "
+ inImage.getSource().getClass()
+ " aspect ratio = "
+ scaledW + " , " + scaledH);
img = inImage.getScaledInstance(scaledW , scaledH, Image.SCALE_SMOOTH);
return img;
// ================== img RIFERIMENTO
public void imgRif(){
frameP.setVisible(false);//tolgo frame
rifno=1;
spiega.setText (" Con il mouse indicare l'immagine di riferimento"+newline);
}//fine imgRif
// ================== BARRA PROGRESS
public void barraP(){
final JFrame framePb = new JFrame("ELABORAZIONE in corso");
framePb.setSize(300,1000);
framePb.setBackground(bluex);
statusInfo.append(" Elaborazione in corso... "+newline);
JPanel panelPb=new JPanel(new BorderLayout());
panelPb.setBackground(bluex);
panelPb.setBorder(BorderFactory.createLineBorder(Color.black));
panelPb.setPreferredSize(new Dimension(300,100));
framePb.getContentPane().add(panelPb);
task = new LongTask();
progressBar = new JProgressBar(0, task.getLengthOfTask());
progressBar.setValue(0);
progressBar.setStringPainted(true);
panelPb.add(progressBar);
//Create a timer.
timer = new javax.swing.Timer(ONE_SECOND, new ActionListener() {
public void actionPerformed(ActionEvent evt) {
progressBar.setValue(task.getCurrent());
String s = task.getMessage();
if (task.isDone()) {
Toolkit.getDefaultToolkit().beep();
timer.stop();
statusInfo.append(" Eseguita elaborazione "+newline);
spiega.setText (" 4. Migliora, Salva, Nuovo progetto o Esci"+newline);
superR.setVisible(false);
mosaica.setVisible(false);
salvab.setVisible(true);
migliora.setVisible(true);
nuovob.setVisible(true);
framePb.setVisible(false);
framePb.setCursor(null); //turn off the wait cursor
progressBar.setValue(progressBar.getMinimum());
//panelpane.removeAll();
//inserisco mosaico creato
framePb.pack();
framePb.setVisible(true);
framePb.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
task.go();
timer.start();
framePb.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
// ===================================================================================== EVENTI
public void actionPerformed(ActionEvent e) {
Object source = e.getSource(); //chi ha invocato evento
// ====================================================================================== NUOVO
if((source == nuovo)||(source == nuovob)){
System.out.println("Nuovo");
mio m = new mio();
// ====================================================================================== HELP
if(source == help){
System.out.println("Help");
final JFrame framePh = new JFrame(" - H E L P - ");
framePh.setSize(300,1000);
JTextArea help=new JTextArea(" Help per utente! "+newline,5,40);
help.setEditable(false);
help.setBorder(BorderFactory.createLineBorder(Color.black));//bordo
//help.setBackground(bluex);
JButton escih = new JButton(" Esci ");
escih.setBackground(bluex);
escih.addActionListener(new ActionListener(){ //quando premo esci
public void actionPerformed(ActionEvent e){
framePh.setVisible(false); // SQUALLIDO! esci meglio!
framePh.getContentPane().add(help);
framePh.pack();
framePh.setVisible(true);
// ======================================================================================== APRI
if((source == apriimgf) || (source == apriimg)){ //apri + img
System.out.println("Apri");
scelta=1; //immagini
Image imgresize;
JFileChooser fileChooser = new JFileChooser();
fileChooser.addChoosableFileFilter(new ImageFilter());//filtro
fileChooser.setAcceptAllFileFilterUsed(false);
fileChooser.setAccessory(new ImagePreview(fileChooser));//anteprima
fileChooser.setCurrentDirectory(new File("."));
fileChooser.setMultiSelectionEnabled(true);
int status = fileChooser.showOpenDialog(null);
if (status == JFileChooser.APPROVE_OPTION) {
File selectedFiles[] = fileChooser.getSelectedFiles();
if (selectedFiles.length>12){
System.out.println("selezionati piu' di 12 img");
return;
if (Nimg>12){
System.out.println("Ho piu' di 12 img");
return;
//int imgora = Nimg + selectedFiles.length; //immagini totali caricate fin'ora
int imgPrima = Nimg; //img prima di inserire le selezionate
int imgIns = selectedFiles.length; //immagini inserite ora.
for (int im=0,n=selectedFiles.length; im<n; im++) {
icon = new ImageIcon(selectedFiles[im].getAbsolutePath());
statusInfo.append(" Inserito: " + selectedFiles[im].getName() + newline);
int hicon = icon.getIconHeight();
int wicon = icon.getIconWidth();
if ((hicon>183)||(wicon>225)){
imgresize = resizeIcon(selectedFiles[im].getAbsolutePath()); // resize
icon = new ImageIcon(imgresize);
if (ximg>675){
if (yimg>366){
System.out.println(" TROPPE IMG!!! ");
else{
ximg=0;
yimg=yimg+ygrid;
image = new JLabel(icon);
image.setBounds(ximg,yimg,hicon,wicon);
//aggiorno dati IMMAGINI
yimgs[im+imgPrima]=yimg;
ximgs[im+imgPrima]=ximg;
images[im+imgPrima] = image;
himgs[im+imgPrima] = hicon;
wimgs[im+imgPrima] = wicon;
statusInfo.append("");
panelpane.add(images[im+imgPrima], new Integer(0),12-(im+imgPrima)); //ULTIMA SOPRA
//images[im+imgPrima].setLocation(ximgs[im+imgPrima],yimgs[im+imgPrima]);
ximg = ximg + xgrid;
Nimg=Nimg+1; //n img totale
ok.setEnabled(true); //abilito
aprimos.setEnabled(false); //abilito
spiega.setText (" 2.Con il mouse spostare le immagini creando un 'mosaico'"+newline);
// ============================================================================= apri mosaico
if((source == aprimos)||(source == aprimosf)){
System.out.println("Apri mosaico");
scelta=2; //mosaico
JFileChooser fileChooser = new JFileChooser();
fileChooser.addChoosableFileFilter(new ImageFilter());//filtro
fileChooser.setAcceptAllFileFilterUsed(false);
fileChooser.setAccessory(new ImagePreview(fileChooser));//anteprima
fileChooser.setCurrentDirectory(new File("."));
fileChooser.setMultiSelectionEnabled(false);
int status = fileChooser.showOpenDialog(null);
if (status == JFileChooser.APPROVE_OPTION) {
File selectedFile = fileChooser.getSelectedFile();
icon = new ImageIcon(selectedFile.getAbsolutePath());
int hicon = icon.getIconHeight();
int wicon = icon.getIconWidth();
image = new JLabel(icon);
image.setBounds(ximg,yimg,hicon,wicon);
statusInfo.append("");
panelpane.add(image,new Integer(1),1);//dopo sopra
ok.setEnabled(true); //abilito
apriimg.setEnabled(false); //abilito
aprimos.setEnabled(false); //abilito
spiega.setText (" 2. Proseguire"+newline);
// =============================================================================== SALVA
if(source == salva){
System.out.println("Salva");
try {
FileOutputStream fos = new FileOutputStream ("info.doc"); //doc.ser
ObjectOutputStream oos = new ObjectOutputStream (fos);
String infoo = statusInfo.getText(); // NON E' GIUSTO!!!
oos.writeObject(infoo);
oos.flush();
oos.close();
statusInfo.append(" Salvato il progetto in: info.doc"+newline);
} catch (IOException e1) {
statusInfo.setText (" Unable to save");
e1.printStackTrace(); //scrivo eccezione
// =============================================================================== PROSEGUI
if(source == ok){
System.out.println("Prosegui");
apriimg.setVisible(false);
aprimos.setVisible(false);
ok.setVisible(false);
mosaica.setVisible(true);
panelpane.removeMouseMotionListener(this);
if (scelta==1){
superR.setVisible(true);
panelpane.revalidate ();
spiega.setText (" 3. Scegliere Mosaicatura o Super-Risoluzione"+newline);
}else{
panelpane.revalidate ();
spiega.setText (" 3. Eseguire Mosaicatura"+newline);
// ================================================================================= ESCI
if((source == esci)||(source==chiudi)){
System.out.println("Esci");
System.exit(0);
// =================================================================================== ANNULLA
if(source == annulla){
System.out.println("Annulla");
// ======================================================================================== MOSAICA
if(source == mosaica){
System.out.println("Mosaica");
frameP = new JFrame("Parametri di Mosaicatura");
frameP.setSize(800,800);
frameP.setBackground(bluex);
JPanel panelP=new JPanel(new GridLayout(1,0));
panelP.setBackground(bluex);
panelP.setBorder(BorderFactory.createLineBorder(Color.black));
panelP.setPreferredSize(new Dimension(500,500));
frameP.getContentPane().add(panelP);
JPanel panelP0 = new JPanel(new FlowLayout()); //avvia
panelP0.setBackground(bluex);
panelP0.setBorder(BorderFactory.createLineBorder(Color.black));
panelP.add(panelP0);
JPanel panelP1 = new JPanel(new FlowLayout());//parametri
panelP1.setBackground(bluex);
//panelP1.setLayout(new BoxLayout(panelP1, BoxLayout.Y_AXIS));
panelP1.setBorder(BorderFactory.createLineBorder(Color.black));
panelP.add(panelP1);
JPanel panelP2=new JPanel(new FlowLayout());
panelP2.setBackground(bluex);
panelP2.setBorder(BorderFactory.createLineBorder(Color.black));
panelP.add(panelP2);
//**************** panel 1 : PARAMETRI
JTextArea dico3 = new JTextArea(" Parametri di miscelazione",10,40);
dico3.setEditable(false);
dico3.setBorder(BorderFactory.createLineBorder(Color.black));//bordo
JRadioButton primo = new JRadioButton("First frame");
primo.setActionCommand("first");
primo.setSelected(true);
primo.setBackground(bluex);
JRadioButton secondo = new JRadioButton("Last frame");
secondo.setActionCommand("last");
secondo.setBackground(bluex);
JRadioButton terzo = new JRadioButton("Average");
terzo.setActionCommand("average");
terzo.setBackground(bluex);
JRadioButton quarto = new JRadioButton("Median");
quarto.setActionCommand("median");
quarto.setBackground(bluex);
JRadioButton quinto = new JRadioButton("Feathering");
quinto.setActionCommand("feathering");
quinto.setBackground(bluex);
final ButtonGroup group = new ButtonGroup(); //raggruppo x fare esclusione
group.add(primo);
group.add(secondo);
group.add(terzo);
group.add(quarto);
group.add(quinto);
// ******** panel 0 : avvia
JTextArea dico = new JTextArea(" Se si vuole avviare la mosaicatura premere 'Avvia'" newline" in tal caso se non sono stati settati parametri verranno utilizzati quelli di default",10,40);
dico.setEditable(false);
dico.setBorder(BorderFactory.createLineBorder(Color.black));//bordo
JButton ok1 = new JButton("Avvia");
ok1.setBackground(bluex);
ok1.addActionListener(new ActionListener(){ //quando premo ok ...
public void actionPerformed(ActionEvent e){
String command = group.getSelection().getActionCommand();
statusInfo.append(" Parametri di mosaicatura, miscelazione: "+command + newline);
frameP.setVisible(false); // SQUALLIDO! esci meglio!
barraP();
mettiMosaico();
// ******** panel 2 : IMG RIFERIMENTO
dico2 = new JTextArea(" Per impostare l'immagine di riferimento" newline " premere 'Imposta' e selezionare l'immagine "+newline,10,40);
dico2.setEditable(false);
dico2.setBorder(BorderFactory.createLineBorder(Color.black));//bordo
JButton imposta = new JButton("Imposta");
imposta.setBackground(bluex);
imposta.addActionListener(new ActionListener(){ //quando premo ok ...
public void actionPerformed(ActionEvent e){
String command = group.getSelection().getActionCommand();
imgRif();
panelP1.add(dico3);
panelP1.add(primo);
panelP1.add(secondo);
panelP1.add(terzo);
panelP1.add(quarto);
panelP1.add(quinto);
panelP0.add(dico);
panelP0.add(ok1);
panelP2.add(dico2);
panelP2.add(imposta);
primo.addActionListener(this);
secondo.addActionListener(this);
JTabbedPane tabbedPane = new JTabbedPane(); //a schedario
tabbedPane.setBackground(bluex);
tabbedPane.addTab("Avvia Mosaicatura", null, panelP0, null);
tabbedPane.addTab("Parametri", null, panelP1, null);
tabbedPane.addTab("Img Riferimento", null, panelP2, null);
tabbedPane.setSelectedIndex(0);
panelP.add(tabbedPane);
frameP.pack();
frameP.setVisible(true);
// ========================================================================== super risoluzione
if(source == superR){
System.out.println("Super-risoluzione");
final JFrame frameP = new JFrame("Parametri di Super-risoluzione");
frameP.setSize(800,800);
frameP.setBackground(bluex);
JPanel panelP = new JPanel(new GridLayout(1,0));
panelP.setBackground(bluex);
panelP.setBorder(BorderFactory.createLineBorder(Color.black));
panelP.setPreferredSize(new Dimension(500,500));
frameP.getContentPane().add(panelP);
JPanel panelP0 = new JPanel(new FlowLayout()); //avvia
panelP0.setBackground(bluex);
panelP0.setBorder(BorderFactory.createLineBorder(Color.black));
panelP.add(panelP0);
JPanel panelP1 = new JPanel(new FlowLayout());//parametri
panelP1.setBackground(bluex);
panelP1.setBorder(BorderFactory.createLineBorder(Color.black));
panelP.add(panelP1);
//**************** panel 1 : PARAMETRI
JTextArea dico3 = new JTextArea(" Parametri di super-risoluzione",10,40);
dico3.setEditable(false);
dico3.setBorder(BorderFactory.createLineBorder(Color.black));//bordo
JRadioButton primo = new JRadioButton("Nearest");
primo.setActionCommand("nearest");
primo.setSelected(true);
primo.setBackground(bluex);
JRadioButton secondo = new JRadioButton("Weighted");
secondo.setActionCommand("weighted");
secondo.setBackground(bluex);
final ButtonGroup group = new ButtonGroup(); //raggruppo x fare esclusione
group.add(primo);
group.add(secondo);
// ******** panel 0 : avvia
JTextArea dico = new JTextArea(" Se si vuole avviare la super-risoluzione premere 'Avvia'" newline" in tal caso se non sono stati settati parametri verranno utilizzati quelli di default",10,40);
dico.setEditable(false);
dico.setBorder(BorderFactory.createLineBorder(Color.black));//bordo
JButton ok1 = new JButton("Avvia");
ok1.setBackground(bluex);
ok1.addActionListener(new ActionListener(){ //quando premo ok ...
public void actionPerformed(ActionEvent e){
String command = group.getSelection().getActionCommand();
statusInfo.append(" Parametri super-risoluzione: "+command + newline);
frameP.setVisible(false); // SQUALLIDO! esci meglio!
barraP();
panelP1.add(dico3);
panelP1.add(primo);
panelP1.add(secondo);
panelP0.add(dico);
panelP0.add(ok1);
primo.addActionListener(this);
secondo.addActionListener(this);
JTabbedPane tabbedPane = new JTabbedPane(); //a schedario
tabbedPane.setBackground(bluex);
tabbedPane.addTab(" Avvia super-risoluzione", null, panelP0, null);
tabbedPane.addTab(" Parametri", null, panelP1, null);
tabbedPane.setSelectedIndex(0);
panelP.add(tabbedPane);
frameP.pack();
frameP.setVisible(true);
mettiMosaico();
// ===================================================== Mouse Event
public void mousePressed(MouseEvent e) {
mousex = e.getX(); // Save the x coord of the click
mousey = e.getY(); // Save the y coord of the click
for (int m=0; m<Nimg; m++){
Point p = images[m].getLocation(); //posizione img[m] in panel
px = (int)p.getX();
py = (int)p.getY();
if (mousex >= px && mousex <= (px+images[muovi].getWidth())
&& mousey >= py && mousey <= (py+images[muovi].getHeight())) {//se mouse dentro img
_canDrag = true;
_dragFromX = mousex-px; // how far from left
_dragFromY = mousey-py; // how far from top
muovi = m; //setto immagine da muovere!!!!
if (rifno==0){panelpane.moveToFront(images[muovi]);}//davanti img ke muovo
//se =1 nn mi muove img
}//chiudo FOR
if (rifno==1){
statusInfo.append(" Immagine di riferimento: "+ muovi + newline);
frameP.setVisible(true);
dico2.append(" Immagine di riferimento impostata :"+muovi + newline);
rifno=0;
public void mouseDragged(MouseEvent e) {
if (_canDrag) { // True only if button was pressed inside ball.
//--- Ball pos from mouse and original click displacement
int ballX = e.getX() - dragFromX;
int ballY = e.getY() - dragFromY;
images[muovi].setLocation(_ballX,_ballY);
//--- Don't move the ball off the screen sides
ballX = Math.max(ballX, 0);
ballX = Math.min(ballX, panelpane.getWidth() - images[muovi].getWidth());
//--- Don't move the ball off top or bottom
ballY = Math.max(ballY, 0);
ballY = Math.min(ballY, panelpane.getHeight() - images[muovi].getHeight());
Point p = images[muovi].getLocationOnScreen();
int px = (int)p.getX();
int py = (int)p.getY();
//panelpane.repaint(); // Repaint because position changed.
public void mouseExited(MouseEvent e) {
_canDrag = false;
}//end mouseExited
public void mouseEntered (MouseEvent e) {} // ignore these events
public void mouseClicked (MouseEvent e) {
public void mouseReleased(MouseEvent e) {
//e.consume();
} // ignore these events
public void mouseMoved(MouseEvent e) {}
}// chiude classeplease reuse the threads you've already started on this topic
http://forum.java.sun.com/thread.jspa?threadID=573384&tstart=50
and also, use the [url http://forum.java.sun.com/help.jspa?sec=formatting]formatting tags when posting code.
keep in mind, this is an awful lot of code, and few will have the time to read through all of it, so if at all possible, make a smaller example case for your problem when you can so that we don't have to try to sort through hundreds of lines of code to find what you want to do. -
Please save us from the Community Help threads
In the Illustrator forum we are getting some silly threads that no one know what to do about. It seems to be posted by Community Help with an article that the first post seems to be a question about, but it is all completely unintelligible to us, the natives, and the supposed first poster seems to have no clue of being transferred.
So far, we have two threads:
http://forums.adobe.com/message/4205555?tstart=0#4205555
http://forums.adobe.com/thread/962694?tstart=0
Please spare us, we have enough to do with providing real community help.
For some (or no) reason I was unable to post a reply in the other thread,
http://forums.adobe.com/thread/955582?tstart=0Jacob Bugge wrote:
http://forums.adobe.com/message/4205555?tstart=0#4205555
What I see is someone who has asked the simple, straightforward question, "What are the best practices for creating web graphics?", then the natives going on to discuss anything but the best practices for creating web graphics.
Has something changed since it was posted? Did it get edited?
Frankly - and I'm sorry to be blunt - if I had asked that particular question then been redirected to a discussion of wonga-wonga birds, dirt track minds, snow, and other nonsense, I'd just turn away quite disappointed with the quality of the help. And, to make matters worse, the entire blob of noise is now tied to the Adobe Help page for Illustrator.
I see that Steve just a little while ago posted the very pertinent comment: "Mods might need to delete the off topic posts, so that the help files only have relevant info."
Was there something wrong with assuming Anup Rav genuinely wanted more information and/or was just commenting on the extreme terseness of that page and either:
A) Addressing the question directly?
-or-
B) Just not saying anything so that someone else could address it?
Even the following would have been more helpful...
C) This help topic certainly does seem a bit light on information.
-Noel -
I'm so depressed -- what happened to the old days when you could actually get a person in support and not have to join a forum -?
I purchased adobe acrobat to convert a PDF to a word document - that's all I wanted --
Now every damn PDF I receive or try to open can only be saved in the adobe cloud -- which I have no interest in -- and not on my computer --
How can I resolve this situation --
I can't seem to find "settings" or "support" --
Yes, I'm over 50 -- and I struggle with this maddening technology -- nothing is simple or straightforward --
I scanned a document, emailed it to myself and would like to name it and save it to my computer -- used to be a 3 minute process -- now its 30 minutes (of valuable, but wasted time later) -- and here I am -- seeking help from no one in particular! The anonymous "forum" --No -- I installed adobe acrobat -- and now, whether I'm signed in or not -- the little disc/save icon is whited out and it can no longer be selected -- when I open a PDF I can only save it to the cloud
I am a physician, and a lot of what I look at is protected health information --- I can't be saving it in the cloud!!! I have to find a way to disable this feature -- and restore my ability to save to my hard drive ONLY --
Thanks -- but if you can tell me those things, I'll be grateful
tried to attach screen shot to show you, but it was too big ....... -
I am running a laptop with windows 7 and am trying to use the save as feature in Photoshop CS6 and it wont let me save as anything. Can someone please help me with this?
A screenshot of your Photoshop work area showing the open file you want to save as, the Layers panel open, and the Save as... dialog open might give us a clue as to what is going on.
To take a screenshot and save it as a file
For Windows 7, Printscreen, open a New File in Photoshop, Ctrl v to paste, then save as jpeg (the other trick was for windows 8)
Use the Camera icon on your reply to upload it.
Also File > Save for Web is a good workaround if you just need a jpeg, png, or gif.
Gene -
I'm getting this error message when I try to save my files and it is happening often enough that it bothers me. This is very sudden - within the last week or two. I have Photoshop CS5, using Windows 7. I get the error message "Could not save as *** because the file is already in use or was left open by another application."
I haven't done anything new to my computer or installed anything new, I've been using CS5 successfully since this summer when I first installed it on this brand new computer. Not sure why it's doing this now.
When it happens, it does leave a .tmp file behind with each instance. I saved one this time just in case it's needed to determine the problem - normally I just delete it and try again. When I try multiple times, it eventually saves. But when I'm a professional photographer and have 100's of images to save, I just can't deal with this problem. Can anyone help? I'd be grateful!Are you saying you've disabled Spyware Doctor and it now works? I'd toss that software out in a heartbeat if so. Anti-malware software that interferes with your normal operation of your computer is not something to be accepted!
Microsoft's Windows Defender is a decent substitute. I also personally prefer Avast Pro antivirus. Both are unobtrusive.
-Noel -
I am unable to install itunes. I get the pop-up asking if I want to save or cancel the iTunes64 file. I click save... and then nothing happens. Help!
I'd first try downloading an installer from the Apple website using a different web browser:
http://www.apple.com/quicktime/download/
If you use Firefox instead of IE for the download (or vice versa), do you get a working installer? -
I have been to the bottom of the application site where you can hit either save and return later or apply. but now it stops before the end of the application and won't let me move any further down the webpage.
Samaia wrote:
Recently switched to Mac and I was a IBM keyboard shortcut maniac I love them.
So far I haven't been able to get my Cmd+Down or Cmd+Up working as described (e.g. move cursor to end or beginning of document) when using Word 2008.
So . . . I updated to Word 2011 - and it still isn't working . . . please tell me there is another short key that I haven't found yet. The Cmd+Down and/or Cmd+Up only take me up or down a paragraph and Fn+Up or Down seem to be the equivalent of clicking the scroll bar up and/or down one page worth.
Is it difficult to trigger the menu item entitled "Keyboard Shortcuts" in the Pages Help menu ?
Yvan KOENIG (VALLAURIS, France) mardi 22 mars 2011 19:38:46 -
One of my customers is complaining that the help contents will scroll out of view when the window is resized. Is there a way to anchor the position while the window is resized?
My CHM is a help file for an application. The application uses F1 to open specific topics for help. Therefore the help file needs to be visible but not cover the application to much. The Content in this situation is text however the help project contains Images, tables, text, etc.
If the user searches for the word "audio" in the search and it takes them to a section or sub topic that is half way down in the Topic, they would like that section or subtopic to stay in the same place as they resize the help window. Using Bookmarks if the topic is large enough clicking the search link will place the results in the top left of the doc view window, however this is not necessarily the top of the topic.
Im not sure how else to explain what the user is seeing, sorry.
Please explain "Also whether it remains consistent depends on whether an absolute or percentage value has been added to it." -
I have installed MS Office 2011 on our iMac and Macbook Air. The program works as expected on the Macbook Air. However, on the iMac, neither Word nor Excel will save files to the internal hard drive. Both save files to a USB memory stick. The error message I receive is:
This is not a valid file name.
Try one or more of the following:
* Chech the path to make sure it was typed correctly.
* Select a file from the list of files or folders.
I expect it is something with the file saving options, but haven't been able to sort it out.
Help please.Found the answer with the help of Microsoft Office for Mac telephone support.....
The name of the Mac Hard drive started with "\"
Microsoft office can't cope with that.
Renamed the hard drive without the back-slash and it works fine. -
Hi! I was using Microsoft Word. And it said that the server was offline when I went to save it. The program crashed, and I have lost my report! Help!!!
I was thinking there has to be a recovery file on the computer somewhere! Right?
Help!Versions of Word on Windows make a backup file with the extension .abk, if that has been enabled in their options, I do not know whether the Mac versions do, or whether you enabled it but try using Spotlight to search for .abk or just abk.
Where were you trying to save? a network server drive? -
Photos in my from my iPhone have the same numbering as photos from my digital camera. They all go into iPhoto fine but when I backup to my ext hard drive it will only save one with the name IMG 1002 and I have two separate images both with that name. How do I get them all to save on my ext hard drive and hope do I prevent this numbering overlap in the future? I'm really hoping I don't have to go through and manually rename every single picture. Thanks.
How are you backing up the photos? The best way is to backup the library itself as that will preserve your organizational efforts as well as all metadata like keywords, titles, faces, places, books, etc.
You can use a backup application that does incremental backups. Thus only the first backup is a full one and subsequent backups just copy those files that are new or changed. I use Synk Pro. The lower cost version, Synk, will do the same job. Other similar apps can be found at MacUpdate.com.
OR: upload your camera to a folder on the Desktop. There you can rename the files to something that is more informative than just the file name. I use the date (international format) along with a brief desc: 2007-1-20-adian1stbday-001.jpg. File renaming apps can also be found at MacUpdate.com. Also you can give the folder an informatve name which will become the Event name when you import the folder of photos into iPhoto.
OT -
HELP - how do you save pictures through the recovery mode?
How do you save pictures through the recovery mode. I have the black screen with cursor and despite trying all the tips noted here nothing seems to fix the issue. These have included using Utility disk to re-install OS-X, repairing the disks. Also tried the holding shift on start up and entering username and password. Also tried internet recovery and then repair and re-install. Nothing works!
Happy to restore from a back up, but I have been rubbish and not backed up for a long time. Also happy to delete and re-install completely but don't want to loose pics.
Please let me know any suggestions!!bemsley wrote:
Is it possible to attach an external drive and copy across files through the utility function?
That requires that you can boot the MBP.
Or to boot the mac using the time machine back up?
You can try using startup manager:
http://support.apple.com/kb/ht1310
But you still need a working volume where you can install the backed up data.
The good news is that since you have a Time machine backup, you can transfer that data to another Mac or clone:
http://pondini.org/OSX/Setup.html
Ciao. -
How do I take movies and save them on the iPad?
How do I take movies and save them on the iPad?
Thank you for your help.Tank you Jim for responding: "(swipe Video to the selected position - don't just touch it)."
(I can't believe this!) I open camera. tap video: nothing. Swipe video button (where to?) nothing.
Reading videos at a glance in the iPad user guide gives me nothing. I know I must be missing something.
Thank you for your help.
Walter -
Subcontracting PO - Batch number to be made mandatory for the components
Hi All,
I have a situation in Subcontracting PO. The components which are sent to vendor need to be updated with Batch number. Is there any User Exit / Configuration available, which can provide a error message to the user when ever he tries to save the PO without the batch number entered for the components.
SAP allows to save the SC-PO, if the batch numbers are not entered for the components which are batch managed. I have checked the PO Fields in Customizing, which has control of the Batch number for the header material in the material data tab & not for the components which will be available after the BOM icon is clicked.
Appreciate if you experts provide a solution / work around for the above scenario, as the client is a pharma client & they need to exactly match the batch which has been sent out for making Finished product with the Sub contracting vendor.
Thanks for your help & awaiting your reply at the earliest.
Regards,
Sathya PadmanabhanHi,
you shoudl definitively check out SAP best Practices for Pharmaceuticals, which can be foubnd in the helpportal:
http://help.sap.com/bp_pharmav1600/Pharma_US/index.htm
Go to the Business Information area....there are some subcontracting scenarios....
Oliver
Maybe you are looking for
-
Cannot get my 30G classic to sync to my windows laptop. Suggestions?
Bought a used 30g IPOD classic on e-bay (I know, what could go wrong?). Attempts to edit the 5000+ songs left me with the 40 songs I wanted and over 5000 "footprints" or titles of songs where there's no music. You go to play the thing and it has to t
-
how do I access photos in icloud that do not appear on any of my devices?
-
No auth error while executing BI integrated planning Query
Hi to all, I have created integrated planning Query in Bex Query designer. But while executing BI integrated planning query in portal, its giving errror. 1. No authorization for query "IP" 2. You are not authorized to edit this aggregation le
-
I have drawn a logo in 1 color and scanned it into Photoshop. How do I now change the color of the outline? It was drawn in black and I want it to be hot pink. Thank you.
-
I downloaded Firefox 4 to my G5 Mac, 1.8 GHz PowerPC, Mac Version 10.5.8, cannot use it. Want to know how do I deinstall it. I have the Firefox 2CD, can I use this to deinstall. Thank you, Georgia Simms