I can't save tif with jpeg compression method

Hello, I've trouble to saving image in tif format with jpeg compression method.
With the same image this option some times is unavailable, randomly, I don't know how.
After some practice I leave that if I open an image previously saved in tif-jpeg the option turn on for the next save.
I've got both CS5 and CS4, and the odd thing is this occour on all.
Someone have triks?
Thanks.
Luca

I know very well the difference betwin a background layer and transparent layer...
I'm writing about a bug, or interference from something, when I want saving an image in tiff format with jpeg compression.
I'm asking if someone had a similar trouble and know a solution and/or trik to solve this!!!
I hope make myself clear.

Similar Messages

  • Error saving TIF image with JPEG compression (IndexColorModel)

    Hi all,
    i recently came upon the following error:
    javax.imageio.IIOException: Metadata components != number of destination bands
         at com.sun.imageio.plugins.jpeg.JPEGImageWriter.checkSOFBands(JPEGImageWriter.java:1279)
         at com.sun.imageio.plugins.jpeg.JPEGImageWriter.writeOnThread(JPEGImageWriter.java:694)
         at com.sun.imageio.plugins.jpeg.JPEGImageWriter.write(JPEGImageWriter.java:339)
         at com.sun.media.imageioimpl.plugins.tiff.TIFFBaseJPEGCompressor.encode(TIFFBaseJPEGCompressor.java:489)
         at com.sun.media.imageioimpl.plugins.tiff.TIFFImageWriter.writeTile(TIFFImageWriter.java:1835)
         at com.sun.media.imageioimpl.plugins.tiff.TIFFImageWriter.write(TIFFImageWriter.java:2686)trying to save a tif file with jpeg compression. The code used is this:
      public static void main(String[] args) throws Exception{
        String s = "c:/sample images/gray_bug/graybug.tif";
        BufferedImage bi = ImageIO.read(new File(s));
        File outFile = new File(s + "-out.tif");
        ImageWriter writer = (ImageWriter)ImageIO.getImageWritersByFormatName("TIF").next();
        ImageOutputStream ios = ImageIO.createImageOutputStream(outFile);
        ios.setByteOrder(ByteOrder.LITTLE_ENDIAN);
        writer.setOutput(ios);
        TIFFImageWriteParam writeParam = new TIFFImageWriteParam(Locale.ENGLISH);
        writeParam.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
        writeParam.setCompressionType("JPEG");
        writeParam.setCompressionQuality(1f);
        IIOImage iioImage = new IIOImage(bi, null, null);
        writer.write(null, iioImage, writeParam);     
        writer.reset();
        writer.dispose();
        ios.flush();
        ios.close();
      }The test image that creates the problem can be found here:
    http://s11.postimage.org/7wl195w8z/graybug.png
    Any ideas what might be wrong?
    I am using imageio 1.2-pre-dr-b04 and JDK 1.6.
    TIA,
    Costas

    I can't help you but here's an exercise for you. When you get an exception you can't explain yourself, try posting it in Google. With a catch: remove anything from the error message that is specific to you like a classname or a specific value.
    In this case there is nothing specific in the error message so try a search for "javax.imageio.IIOException: Metadata components != number of destination bands". One thing is for sure: you're not the first to run into this error.

  • HT4753 Can auto save work with Photoshop 5.0?

    Can auto save work with Photoshop 5.0?
    [email protected]

    No. Autosave/Versions must be built into the app itself to use those OS features. It doesn't work just because it's part of the OS. None of the CS6 apps support it, either. The only Adobe apps that do are the latest versions of Photoshop Elements and Premiere Elements. And that's only because the have to in order to be allowed in the App Store. In both cases, Adobe also gives users a preference to turn it off.
    What Adobe did do in Photoshop CS6 is add an autosave feature of their own. It saves your work according to whatever time increment you choose. Then if the app crashes, it will try to reopen the saved data when you relaunch the app.

  • Tiff image with JPEG compression

    How does photoshop handle RGB and YCbCr as photometric interpretations of tiff image with JPEG compression?
    Are they same?

    Got no idea but here is a website with a adobe pdf answer.
    http://www.ask.com/web?q=How+does+photoshop+handle+RGB+and+YCbCr+as+photometric+interpreta tions+of+tiff+image+with+JPEG+compression%3F&search=&qsrc=0&o=0&l=dir

  • Can't save image with Photoshop.

    We do often have a issue where we can not save the open image in Photoshop CS 6. To this day the problem appears when the image contains Adjustments Layers with Layer Masks.
    It does not matter if we try to save the image locally or on a network volume, we do only get a prompt telling us there is a Program Error. Trying to save as TIFF with layers instead of the preferred PSD format
    does not make any difference also.
    If we create a new image and copy all layers with masks and all the photoshop paths, this image can be saved and the original image can also be saved if we do a flattening prior to saving.
    I do believe this is a bug in photoshop and has nothing to do with corrupted images or other computer related issues. We are working with Macintosh and experience this problem in both Mac OS 10.8.5 and 10.9.3

    JPG compression does not support transparency, I think you
    have to convert it to png of gif first.

  • Can't save file with futura font?

    Hi
    I'm having a problem saving a file that contains the futura font. This is a font my company had to buy. I never had a problem with CS1 or CS2 using this font.
    Once I place the font in the document it will let me save it once. After making changes and trying to save again I get a window that simply says "can't save file". I've tried unchecking the pdf compatible option and the compression option with no change.
    I found one thread on this site about clearing out the font cache (by deleting the file C:\windows\system32\FNTCACHE.dat) and that didn't make a difference.
    When I'm done with the document I'll be converting the text to outlines but I need a fix will I'm working on the doc.
    Thoughts?

    Mike,
    Glad you got it sorted out. After I sent you back the regenerated fonts, I discovered something which I'm posting here for everyone's benefit.
    Myle nailed it when he suggested an "an issue with font embedding." The fonts you sent me were all embedding-restricted. It's possible you could have saved your documents had you turned off the PDF compatibility option, but it's moot now.
    It's doubtful the fonts I regenerated for you will solve the problem because putting them through my font editor did not remove the embedding restriction. I would bet dollars to doughnuts that your replacement fonts do not have embedding restriction.
    To check for the embedding restriction, you don't need a fancy program. Just download this Windows extension from Microsoft and install it. Then, right-click | Properties on any font file will give you a lot more information about that font, including licensing/embedding restrictions.

  • I cant save pics with JPEG or PSD?

    I have Elements 10, last night after doing windows updates, I am unable to save my photos, JPEG or PSD, instead they go to "file" with a blank page icon, which when clicked on tells me " cannot open its the wrong type of file" please can any one advise!

    Thank you so much! from myself and my models!!! I did it, and learnt somthing new! very gratful. Regards Lorrie

  • Photoshop Elements 13 (Mac) Organizer - Can't save file with version sets.

    I have spent many hours now trying to get Elements Organizer to save Version Sets when I've edited a photo. I've tried more or less every little thing you can find online without any luck. But just moments ago I found that if I move the file to my desktop everything works just fine. I then tried to edit files in a few other folders (also imported to my Organizer) and found that when ever the folder was named to something with a nordic letter in it (å, ä, ö) then I couldn't save my file with version sets (option greyed out) but if I moved that same file to another folder, well then everything worked as it's suposed to.
    I'm using the trial version of PSE 13 for Mac (Yosemite) and the full version is ordered and on it's way. But if this problem can't be fixed, I need to return that order and buy some other photo editing program.
    Can anyone help me with this problem? Is there perhaps a solution to this?
    Please, any help is much appreciated!

    I'm using the English version (as more or less always - Swedish is rarely an option). The thing is that I have never encountered this problem before in any other software I've been using, and certainly not in Aperture that I've been using up until now.
    I name my photo folders with a date and a few words, for ex. "2014-12-31 New Years in Stockholm" (but I normally write in Swedish). I use this method so that my folder that contains the original photos will be easy to find in even without any other software than Finder (or Windows Explorer if I connect my external drive to a Windows machine). I could change the name of all of my folders, or at least all of the folders with a name containing one or more of the letters Å, Ä or Ö to "force" PSE to work as it should, but why? This really shouldn't be a problem.
    I was hoping that their was a simple option or something like that that could fix this issue, but I guess not.
    If this problem lies in the software itself I will have to return it and look elsewhere (but where? Lightroom is certainly not an option if Adobe can't handle "normal" letters and Aperture is discontinued in a few months).
    Thank you for your reply!

  • Mail.app can't save draft with irrelevant error message

    hi!
    Mail.app in Leopard with latest updates installed ( System Version: Mac OS X 10.5.5 (9F33), Mail:
    Version: 3.5 Last Modified: 16.09.08 0:50 Kind: Universal Location: /Applications/Mail.app) can not save message as Draft, and wrong error message appears if new message have characters missing in message encoding.
    Test case:
    1. Open mail.app
    2. Compose new message
    3. Select Message->Text Encoding ->Cyrillic (KOI8-R)
    4. Open in Safari http://www.communigate.com/CommunigatePro/Install.html#Solaris
    5. Select text from words Installing on a "Sun Solaris System." to words "Installing on a Linux System."
    6. Copy to clipboard
    7. Switch to mail.app
    8. Edit -> Paste
    9. File->Save
    Error message "Draft can't be saved to Drafts mailbox.
    The message contains one or more attachments that are too large to be saved in the Drafts mailbox. Try to delete some attachments [OK]" will appear
    This message is misleading.
    Correct message "Invalid text encoding
    Some characters in your message coundn't be converted to the "Cyrillic (KOI8-R) text encoding." Appears only if user is trying to send message
    Co

    These forums are user to user. To report things like this to Apple, use the feedback channel:
    http://www.apple.com/feedback/macosx.html

  • Can't save times with timed access

    I have an Airport Extreme and an Airport Express that connects in WDS mode so I can use it as a bridge for device connected to the ethernet port on the Express (shame it isn't documented this runs as 802.11g).
    I want to limit access for devices connecting to the Express but when I try to set timed access, I can change the time but I can't save it. After modifying the time I can't leave the field without cancelling out. Anything else just returns an unhelpful beep.
    Using latest utils and firmware 7.3.1.

    thanks for your replies!
    my enviorments:
    Windows 2000 professional(Chinese Version)
    local setting:Chinese(P.R.C) ------------>previously
    and I have changed to:English(US) ------------>now
    J2EE1.4SDK
    J2SDK1.4.1_03
    Now even I open an existing WAR file that provided by tutorial, it throws errors when I save it. And the corrupt file is some what smaller than the previous correct one.

  • Can you help me with mouse pressed method please?

    hi
    can you help me with my problem please, player label doesn't show up in the applet and the draw string method it doesn't draw any strings like X or O for the game I don't know what is the problem maybe it is with MousePressed method which is in Board class. I tried to write the code of the location many times I'm not sure if the problem comes from there.
    there is no error in my code, but it doesn't work.
    this is class Board which has the mouseListener
    class Board extends JPanel  implements MouseListener, MouseMotionListener
        private JLabel playerlabel; 
         private boolean play;
         private boolean start;
        private int turn; 
        private Square squares[][];
      private Player myplayer[][];
         public Board()
              setBackground( Color.WHITE );
              playerlabel = new JLabel( "X player first" );
              //playerlabel.setLayout(null);
         //     playerlabel.setLocation(500,500);
              add( playerlabel );
              play = true;
              turn = 1;
             squares = new Square[3][3];
             myplayer = new Player[3][3];
             int x = 40;
              int y = 40;
              for (int i=0; i<3; i++){
                   x = 40;
                   for (int j=0; j<3; j++){
                        Square s = new Square( x,y );
                        squares[i][j] = s;
                        x +=50;
                   y +=50;
                this.addMouseListener(this);
            this.addMouseMotionListener(this);
          public void mouseClicked( MouseEvent event ){}
          public void mouseMoved( MouseEvent event ){}
          public void mouseEntered( MouseEvent event ){}
          public void mouseExited( MouseEvent event ){}
          public void mousePressed( MouseEvent event )
          {int xPos = event.getX();
                  int yPos = event.getY();
                    if(play && turn ==1){
                    for (int i=0; i<3; i++){
                        for (int j=0; j<3; j++){
                             int x = squares[i][j].getX();
                             int y = squares[i][j].getY();
                             if(xPos> x && xPos<x+40&& yPos> y && yPos<y+40){
                                  if( squares[i][j].getOccupied() ==0 ){
                                       String ptext;
                                       ptext = "X";
                                       Player p = new Player(x, y,ptext);
                                       myplayer[i][j] = p;
                                       squares[i][j].setOccupied(1);
                                       playerlabel.setText( "O Player Turn" );
                                       turn = 2;
                                       repaint();
                                       Win();
                                  else{
                                       turn = 2;
                                       playerlabel.setText( "O Player Turn" );
                                       repaint();
              if ( play && turn ==2 )
    for (int i=0; i<3; i++){
                        for (int j=0; j<3; j++){
                             int x = squares[i][j].getX();
                             int y = squares[i][j].getY();
                             if(xPos> x && xPos<x+40&& yPos> y && yPos<y+40){
                                  if( squares[i][j].getOccupied() ==0 ){
                                       String ptext;
                                       ptext = "O";
                                       Player p = new Player(x, y,ptext);
                                       myplayer[i][j] = p;
                                       squares[i][j].setOccupied(2);
                                       playerlabel.setText( "X Player Turn" );
                                       turn = 1;
                                       repaint();
                                       Win();
                                  else{
                                       turn = 1;
                                       playerlabel.setText( "X Player Turn" );
                                       repaint();
          public void mouseReleased( MouseEvent event )
          public void mouseDragged( MouseEvent event )
         public void Win(){
              if(squares[0][0].getOccupied() == squares[0][1].getOccupied() &&squares[0][1].getOccupied()==squares[0][2].getOccupied() &&squares[0][2].getOccupied() == 1)
              {playerlabel.setText("Player 1 X WON THE GAME!");
              play =false;          }
              else if (squares[1][0].getOccupied() == squares[1][1].getOccupied() &&squares[1][1].getOccupied()==squares[1][2].getOccupied() &&squares[1][2].getOccupied() == 1)
              {playerlabel.setText("Player 1 X WON THE GAME!");
              play =false;          }
              else      if(squares[2][0].getOccupied() == squares[2][1].getOccupied() &&squares[2][1].getOccupied()==squares[2][2].getOccupied() &&squares[2][2].getOccupied() == 1)
              {playerlabel.setText("Player 1 X WON THE GAME!");
              play =false;          }
                   if(squares[0][0].getOccupied() == squares[0][1].getOccupied() &&squares[0][1].getOccupied()==squares[0][2].getOccupied() &&squares[0][2].getOccupied() == 2)
              {playerlabel.setText("Player 2 O WON THE GAME!");
              play =false;          }
              else if (squares[1][0].getOccupied() == squares[1][1].getOccupied() &&squares[1][1].getOccupied()==squares[1][2].getOccupied() &&squares[1][2].getOccupied() == 2)
              {playerlabel.setText("Player 2 O WON THE GAME!");
              play =false;          }
              else      if(squares[2][0].getOccupied() == squares[2][1].getOccupied() &&squares[2][1].getOccupied()==squares[2][2].getOccupied() &&squares[2][2].getOccupied() == 2)
              {playerlabel.setText("Player 2 O WON THE GAME!");
              play =false;          }
              //Vertically win
               if (squares[0][0].getOccupied() == squares[1][0].getOccupied() &&squares[1][0].getOccupied()==squares[2][0].getOccupied() &&squares[2][0].getOccupied() == 1)
              {playerlabel.setText("Player 1 X WON THE GAME!");
              play =false;          }
              else if (squares[0][1].getOccupied() == squares[1][1].getOccupied() &&squares[1][1].getOccupied()==squares[2][1].getOccupied() &&squares[2][1].getOccupied() == 1)
              {playerlabel.setText("Player 1 X WON THE GAME!");
              play =false;          }
              else      if(squares[0][2].getOccupied() == squares[1][2].getOccupied() &&squares[1][2].getOccupied()==squares[2][2].getOccupied() &&squares[2][2].getOccupied() == 1)
              {playerlabel.setText("Player 1 X WON THE GAME!");
              play =false;          }
               if (squares[0][0].getOccupied() == squares[1][0].getOccupied() &&squares[1][0].getOccupied()==squares[2][0].getOccupied() &&squares[2][0].getOccupied() == 2)
              {playerlabel.setText("Player 2 O WON THE GAME!");
              play =false;          }
              else if (squares[0][1].getOccupied() == squares[1][1].getOccupied() &&squares[1][1].getOccupied()==squares[2][1].getOccupied() &&squares[2][1].getOccupied() == 2)
              {playerlabel.setText("Player 2 O WON THE GAME!");
              play =false;          }
              else      if(squares[0][2].getOccupied() == squares[1][2].getOccupied() &&squares[1][2].getOccupied()==squares[2][2].getOccupied() &&squares[2][2].getOccupied() == 2)
              {playerlabel.setText("Player 2 O WON THE GAME!");
              play =false;          }
              //Diagonal win
                    if (squares[0][0].getOccupied() == squares[1][1].getOccupied() &&squares[1][1].getOccupied()==squares[2][2].getOccupied() &&squares[2][2].getOccupied() == 1)
              {playerlabel.setText("Player 1 X WON THE GAME!");
              play =false;          }
              else if (squares[0][2].getOccupied() == squares[1][1].getOccupied() &&squares[1][1].getOccupied()==squares[2][0].getOccupied() &&squares[2][0].getOccupied() == 1)
              {playerlabel.setText("Player 1 X WON THE GAME!");
              play =false;          }
               if (squares[0][0].getOccupied() == squares[1][1].getOccupied() &&squares[1][1].getOccupied()==squares[2][2].getOccupied() &&squares[2][2].getOccupied() == 2)
              {playerlabel.setText("Player 2 O WON THE GAME!");
              play =false;          }
              else if (squares[0][2].getOccupied() == squares[1][1].getOccupied() &&squares[1][1].getOccupied()==squares[2][0].getOccupied() &&squares[2][0].getOccupied() == 2)
              {playerlabel.setText("Player 2 O WON THE GAME!");
              play =false;          }
         }//end win
    public void setTurn(int t)
              turn = t;
              playerlabel.setText( "X Player Plays First" );
         public void paintComponent( Graphics g )
               super.paintComponent( g );
               this.setBackground( Color.WHITE );
              for (int i=0; i<3; i++){
                   for (int j=0; j<3; j++){
                        g.setColor( Color.BLACK );
                         g.drawRect( squares[i][j].getX(), squares[i][j].getY(), 50, 50 );     
               for (int i=0; i<3; i++){
                   for (int j=0; j<3; j++){
                         myplayer[i][j].draw(g);     
            //End of paintComponent   
    }and this is the whole code of my program.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.util.*;
    class Player{
         private int xCoordinate;
         private int yCoordinate;
        private String playerText;
      public   Player(int x, int y, String t)
            playerText = t;
            xCoordinate = x;
            yCoordinate = y;
        public void draw(Graphics g)
               g.drawString(playerText,  xCoordinate, yCoordinate);
         public void SetText(String t)
         { playerText = t;
    }//end player
    class Square
         private int x;
         private int y;
         private int occupied;
         public Square(int x1, int y1)
              x = x1;
              y= y1;
              occupied = 0;
         public void setX(int x1)
              x = x1;
         public int getX()
              return x;
         public void setY(int y1)
              y = y1;
         public int getY()
              return y;
         public void setOccupied(int o)
              occupied = o;
         public int getOccupied()
              return occupied;
    public class TicTac extends JApplet implements ActionListener
    { private JPanel panel;
         private JButton newgame;
         private Board B;
         public void init()
              B = new Board();
              add( B, BorderLayout.CENTER );
              panel = new JPanel();
               newgame = new JButton( "New Game" );
               panel.add( newgame);
               add( panel, BorderLayout.SOUTH );
               newgame.addActionListener(this);
              public void actionPerformed( ActionEvent ev)
               {     Object source = ev.getSource();
         if (source == newgame)
                    {remove(B);
                   repaint();
              B = new Board();
                   add( B, BorderLayout.CENTER );
         B.setTurn(1);
                   repaint();
                   validate();
            }//end class TicTac
    class Board extends JPanel  implements MouseListener, MouseMotionListener
        private JLabel playerlabel; 
         private boolean play;
         private boolean start;
        private int turn; 
        private Square squares[][];
      private Player myplayer[][];
         public Board()
              setBackground( Color.WHITE );
              playerlabel = new JLabel( "X player first" );
              //playerlabel.setLayout(null);
         //     playerlabel.setLocation(500,500);
              add( playerlabel );
              play = true;
              turn = 1;
             squares = new Square[3][3];
             myplayer = new Player[3][3];
             int x = 40;
              int y = 40;
              for (int i=0; i<3; i++){
                   x = 40;
                   for (int j=0; j<3; j++){
                        Square s = new Square( x,y );
                        squares[i][j] = s;
                        x +=50;
                   y +=50;
                this.addMouseListener(this);
            this.addMouseMotionListener(this);
          public void mouseClicked( MouseEvent event ){}
          public void mouseMoved( MouseEvent event ){}
          public void mouseEntered( MouseEvent event ){}
          public void mouseExited( MouseEvent event ){}
          public void mousePressed( MouseEvent event )
          {int xPos = event.getX();
                  int yPos = event.getY();
                    if(play && turn ==1){
                    for (int i=0; i<3; i++){
                        for (int j=0; j<3; j++){
                             int x = squares[i][j].getX();
                             int y = squares[i][j].getY();
                             if(xPos> x && xPos<x+40&& yPos> y && yPos<y+40){
                                  if( squares[i][j].getOccupied() ==0 ){
                                       String ptext;
                                       ptext = "X";
                                       Player p = new Player(x, y,ptext);
                                       myplayer[i][j] = p;
                                       squares[i][j].setOccupied(1);
                                       playerlabel.setText( "O Player Turn" );
                                       turn = 2;
                                       repaint();
                                       Win();
                                  else{
                                       turn = 2;
                                       playerlabel.setText( "O Player Turn" );
                                       repaint();
              if ( play && turn ==2 )
    for (int i=0; i<3; i++){
                        for (int j=0; j<3; j++){
                             int x = squares[i][j].getX();
                             int y = squares[i][j].getY();
                             if(xPos> x && xPos<x+40&& yPos> y && yPos<y+40){
                                  if( squares[i][j].getOccupied() ==0 ){
                                       String ptext;
                                       ptext = "O";
                                       Player p = new Player(x, y,ptext);
                                       myplayer[i][j] = p;
                                       squares[i][j].setOccupied(2);
                                       playerlabel.setText( "X Player Turn" );
                                       turn = 1;
                                       repaint();
                                       Win();
                                  else{
                                       turn = 1;
                                       playerlabel.setText( "X Player Turn" );
                                       repaint();
          public void mouseReleased( MouseEvent event )
          public void mouseDragged( MouseEvent event )
         public void Win(){
              if(squares[0][0].getOccupied() == squares[0][1].getOccupied() &&squares[0][1].getOccupied()==squares[0][2].getOccupied() &&squares[0][2].getOccupied() == 1)
              {playerlabel.setText("Player 1 X WON THE GAME!");
              play =false;          }
              else if (squares[1][0].getOccupied() == squares[1][1].getOccupied() &&squares[1][1].getOccupied()==squares[1][2].getOccupied() &&squares[1][2].getOccupied() == 1)
              {playerlabel.setText("Player 1 X WON THE GAME!");
              play =false;          }
              else      if(squares[2][0].getOccupied() == squares[2][1].getOccupied() &&squares[2][1].getOccupied()==squares[2][2].getOccupied() &&squares[2][2].getOccupied() == 1)
              {playerlabel.setText("Player 1 X WON THE GAME!");
              play =false;          }
                   if(squares[0][0].getOccupied() == squares[0][1].getOccupied() &&squares[0][1].getOccupied()==squares[0][2].getOccupied() &&squares[0][2].getOccupied() == 2)
              {playerlabel.setText("Player 2 O WON THE GAME!");
              play =false;          }
              else if (squares[1][0].getOccupied() == squares[1][1].getOccupied() &&squares[1][1].getOccupied()==squares[1][2].getOccupied() &&squares[1][2].getOccupied() == 2)
              {playerlabel.setText("Player 2 O WON THE GAME!");
              play =false;          }
              else      if(squares[2][0].getOccupied() == squares[2][1].getOccupied() &&squares[2][1].getOccupied()==squares[2][2].getOccupied() &&squares[2][2].getOccupied() == 2)
              {playerlabel.setText("Player 2 O WON THE GAME!");
              play =false;          }
              //Vertically win
               if (squares[0][0].getOccupied() == squares[1][0].getOccupied() &&squares[1][0].getOccupied()==squares[2][0].getOccupied() &&squares[2][0].getOccupied() == 1)
              {playerlabel.setText("Player 1 X WON THE GAME!");
              play =false;          }
              else if (squares[0][1].getOccupied() == squares[1][1].getOccupied() &&squares[1][1].getOccupied()==squares[2][1].getOccupied() &&squares[2][1].getOccupied() == 1)
              {playerlabel.setText("Player 1 X WON THE GAME!");
              play =false;          }
              else      if(squares[0][2].getOccupied() == squares[1][2].getOccupied() &&squares[1][2].getOccupied()==squares[2][2].getOccupied() &&squares[2][2].getOccupied() == 1)
              {playerlabel.setText("Player 1 X WON THE GAME!");
              play =false;          }
               if (squares[0][0].getOccupied() == squares[1][0].getOccupied() &&squares[1][0].getOccupied()==squares[2][0].getOccupied() &&squares[2][0].getOccupied() == 2)
              {playerlabel.setText("Player 2 O WON THE GAME!");
              play =false;          }
              else if (squares[0][1].getOccupied() == squares[1][1].getOccupied() &&squares[1][1].getOccupied()==squares[2][1].getOccupied() &&squares[2][1].getOccupied() == 2)
              {playerlabel.setText("Player 2 O WON THE GAME!");
              play =false;          }
              else      if(squares[0][2].getOccupied() == squares[1][2].getOccupied() &&squares[1][2].getOccupied()==squares[2][2].getOccupied() &&squares[2][2].getOccupied() == 2)
              {playerlabel.setText("Player 2 O WON THE GAME!");
              play =false;          }
              //Diagonal win
                    if (squares[0][0].getOccupied() == squares[1][1].getOccupied() &&squares[1][1].getOccupied()==squares[2][2].getOccupied() &&squares[2][2].getOccupied() == 1)
              {playerlabel.setText("Player 1 X WON THE GAME!");
              play =false;          }
              else if (squares[0][2].getOccupied() == squares[1][1].getOccupied() &&squares[1][1].getOccupied()==squares[2][0].getOccupied() &&squares[2][0].getOccupied() == 1)
              {playerlabel.setText("Player 1 X WON THE GAME!");
              play =false;          }
               if (squares[0][0].getOccupied() == squares[1][1].getOccupied() &&squares[1][1].getOccupied()==squares[2][2].getOccupied() &&squares[2][2].getOccupied() == 2)
              {playerlabel.setText("Player 2 O WON THE GAME!");
              play =false;          }
              else if (squares[0][2].getOccupied() == squares[1][1].getOccupied() &&squares[1][1].getOccupied()==squares[2][0].getOccupied() &&squares[2][0].getOccupied() == 2)
              {playerlabel.setText("Player 2 O WON THE GAME!");
              play =false;          }
         }//end win
    public void setTurn(int t)
              turn = t;
              playerlabel.setText( "X Player Plays First" );
         public void paintComponent( Graphics g )
               super.paintComponent( g );
               this.setBackground( Color.WHITE );
              for (int i=0; i<3; i++){
                   for (int j=0; j<3; j++){
                        g.setColor( Color.BLACK );
                         g.drawRect( squares[i][j].getX(), squares[i][j].getY(), 50, 50 );     
               for (int i=0; i<3; i++){
                   for (int j=0; j<3; j++){
                         myplayer[i][j].draw(g);     
            //End of paintComponent   
            Edited by: mshadows on May 18, 2008 7:53 AM

    I was playing with this a little bit and came up with this game model, something that I'm sure can be improved upon greatly:
    TttXO.java
    an enum to encapsulate X vs O. I could use a boolean here since it has 2 states, but this seems more intuitive to me
    package dy08.m05.ttt;
    * tic tac toe encapsulation of X vs O
    * @author Pete
    public enum TttXO
        X, O
    }TttCell.java
    encapsulates an individual cell in the tictactoe grid.
    package dy08.m05.ttt;
    * Tic Tac Toe Game cell
    * can be occupied or not
    * can hold TttXO X or O or null 
    * @author Pete
    public class TttCell
        private boolean occupied = false;
        private TttXO xo = null;
        public TttCell()
         * sets a Square for either x or o
         * @param TttXO
         * @return true if successful, false if already occupied
        public boolean setXO(TttXO xo)
            if (occupied)
                return false;
            else
                occupied = true;
                this.xo = xo;
                return true;
        public void reset()
            occupied = false;
            xo = null;
        public boolean isOccupied()
            return occupied;
        public TttXO getXO()
            return xo;
        // used to test and debug the class
        public String toString()
            if (occupied)
                return xo.toString();
            else
                return "-";
    package dy08.m05.ttt;
    * Tic Tac Toe game model
    * @author Pete
    public class TttGameModel
        private TttCell[][] cellGrid = new TttCell[3][3];
        private boolean xTurn = true;
        private boolean win = false;
        public TttGameModel()
            for (int i = 0; i < cellGrid.length; i++)
                for (int j = 0; j < cellGrid.length; j++)
    cellGrid[i][j] = new TttCell();
    public void reset()
    xTurn = true;
    win = false;
    for (int i = 0; i < cellGrid.length; i++)
    for (int j = 0; j < cellGrid[i].length; j++)
    cellGrid[i][j].reset();
    public boolean isXTurn()
    return xTurn;
    public boolean isWin()
    return win;
    * @param row
    * @param col
    * @return true if valid move, false if game already over or cell occupied
    public boolean takeTurn(int col, int row)
    TttXO currentXO = TttXO.O;
    TttCell cell = cellGrid[row][col];
    if (win)
    return false;
    if (cell.isOccupied())
    return false;
    if (xTurn)
    currentXO = TttXO.X;
    cell.setXO(currentXO);
    win = checkWin(col, row, currentXO);
    xTurn = !xTurn; // toggle xturn
    return true;
    public boolean checkWin(int col, int row, TttXO xo)
    boolean win = false;
    // first rows and columns
    boolean temp = true;
    for (int i = 0; i < 3; i++)
    temp &= cellGrid[row][i].getXO() == xo;
    win |= temp;
    temp = true;
    for (int i = 0; i < 3; i++)
    temp &= cellGrid[i][col].getXO() == xo;
    win |= temp;
    if (row == col) // if slash diagonal
    temp = true;
    for (int i = 0; i < 3; i++)
    temp &= cellGrid[i][i].getXO() == xo;
    win |= temp;
    if (row + col == 2) // if backslash diagonal
    temp = true;
    for (int i = 0; i < 3; i++)
    temp &= cellGrid[i][2 - i].getXO() == xo;
    win |= temp;
    return win;
    // used to test and debug the class
    public String toString()
    StringBuilder sb = new StringBuilder();
    for (int i = 0; i < cellGrid.length; i++)
    for (int j = 0; j < cellGrid[i].length; j++)
    sb.append(cellGrid[i][j] + " ");
    sb.append("\n");
    if (win)
    sb.append("win! Game over");
    else
    sb.append("No winner yet");
    return sb.toString();
    // test the class
    public static void main(String[] args)
    TttGameModel model = new TttGameModel();
    checkMove(model, 0, 0);
    checkMove(model, 1, 0);
    checkMove(model, 1, 1);
    checkMove(model, 2, 0);
    checkMove(model, 1, 0); // bad move
    checkMove(model, 2, 2);
    // to test the class
    private static void checkMove(TttGameModel model, int i, int j)
    System.out.println("OK move: " + model.takeTurn(i, j));
    System.out.println(model + "\n");

  • Can't save tif's in yosemite

    Does anyone else have this problem, I can save jpegs but not tif's

    Two other options would be Photoshop Cleaner: Photoshop CC 2014 Slow Over Time
    Or ( since there seems to be a lot of problems cropping up with Yosemite) doing a "clean" download instead of an Upgrade. Pro tip: Troubleshooting 10 known OS X Yosemite issues - TechRepublic

  • Can't save directly with word 2007, powerpoint 2007

    hi,
    we have a mac mini server with
    - mac os x 10.6.2 server
    - I created 3 workgroups
    - sharepoints, that are directly on the boot disk (User/Shared/folder1...)
    for mac-user everything works fine, but windows users (1x win xp with office 2007, 1x win 7 with office 2010) can’t directly save to the server, they always get an error, that the server is not reachable.
    but if I save the file to the desktop, I can copy it with the explorer in a folder on the server.
    after little investigation I found out, that every microsoft office app creates temporary files while saving and this is the source of all troubles.
    I tried all tips I could find:
    http://discussions.apple.com/thread.jspa?threadID=2249820&tstart=0
    http://discussions.apple.com/thread.jspa?messageID=10611455&#10611455
    http://lists.apple.com/archives/macos-x-server/2008/Jan/msg00760.html
    like:
    - changes in smb.conf
    - acl-rights changes
    - with/without oplock, strict lockings
    but nothing helped.
    and one strange finding:
    if I create a new sharepoint, it uses automatically apples standard „workgroup“ as only group (besides spotlight), now office 2007-user CAN save files directly. if I add one of my groups, the problems reappears.
    so I would like to ask, if someone found a solution for this problem - thx!
    regards,
    ferdinand

    Partially solved. To get the Mac to map the drive, I had to go to Finder > Go > Connect to Server and connect using the drive's static IP address. It connects and I can save just fine. However... the problem is that if I reboot the mapping is gone and I have to repeat the Finder steps. Is there a way to automatically get the Mac to connect to the drive even if I restart? I do have an admin password on the drive if this is part of the problem.

  • How can I save attachments with encoding of iso-2022-jp?

    If attachments have iso-2022-jp encoding, they are not saved, and no warnings or error messages are output.
    Saving the entire email, and opening it in Kmail, I'm able to save the attachment.
    Running up to date Fedora 21, with thunderbird 31.4.0.

    Hey Del...
    That sounds promising but I'm trying to get 3000 emails _off_ my machine, so can that exported mailbox be set up with folders for specific clients or types of business so that I can dump all the emails into the correct folders and then export it completely?  And when I want to retreive a particular client's emails, do I have to retreive the entire mailbox and restore it on my iMac or can I selectively go to "Client Mailbox2011/SmithPlumbing" and just see all the emails to/from Smith Plumbing?  If that can be done... I think we have a winner.  I might have to do it by year so I'd have multiple exported mailboxes and a way to keep current (2014) client email correspondence separate.
    I hope you say yes LOL.  Then you give me some tips on HOW to do that!!!
    Mike

  • How can I save tabs with two open Firefox windows?

    I have two windows of Firefox open; one for tabs of websites I visit regularly and another with tabs for chat rooms. It is a pain having to open these chats on a regular basis which is why I'm wondering if there's a solution to this. Is it possible to save tabs for both windows when closing Firefox?

    Use "Firefox > Exit" or "File > Exit" to close all open windows at once. That is always better then using the close X and is the only way to restore more than one window on a next start via session restore.

Maybe you are looking for

  • Virtual Shopping Mall installation problem

    I was trying to deploy the VSM using EAR(Enterprise Application archive) Deployment method. Step 4 instruction is to Run ant -buildfile build.xml from VSM. When I try to run ant, it display "build.xml file does not exist". I tried searching the build

  • CSM 3.3.1 and 6500

    Hello, We are facing a problem with CSM 3.3.1 and 6500 switch with FWSM. We have 2x 6500 switches with 2 supervisors in each + 2 FWSM cards one in each chassis. The problem is that we have CSM 3.3.1 that manages the switch and FWSM. The problem is th

  • Visual Age and Oracle Drivers

    Does Any one know how to set the path when running Visual Age and Weblogic 4.5.1. I can not get the set the PATH or ORACLE_HOME in VisualAge so the connection pool will start Mike Howard Cessna Aircraft Compan

  • Archive people lost ability

    GWIM 2.0.4 NetWare 6.5 sp 8 We recently moved many of our users to a different (parallel) OU in the tree. Today one of our managers noticed that her "search archive" menu option is missing. I checked the Messenger service's Archive ACL and the manage

  • Having trouble keep video quality

    Hi, I was wondering if anyone can explain this one to me. For some reason when I drag a video into my project now the quality seems to be alot less than if I viewed the original video outside of Premiere. I don't recall noticing this earlier so I may