For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!
How can i replace all rpmnew's with rpm's(current) after an update?
//***Compile this program*** //Libraries // import java.awt.*; import java.io.*; import java.util.*; import javax.swing.*; import java.awt.event.*; import javax.swing.text.*; public class User_Interface extends JFrame { static Levels l = new Levels (); private Container contentPane = getContentPane (); private JPanel main, levelOne; private String level; private boolean repeat = true; private CardLayout cc = new CardLayout (); private GridBagConstraints gbc = new GridBagConstraints (); private JPanel c = new JPanel (); public User_Interface () { //Generates the User-Interface // super ("Trapped"); main = new JPanel (); GridBagLayout gbl = new GridBagLayout (); main.setLayout (gbl); c.setLayout (cc); c.add (main, "Main Page"); contentPane.add (c, BorderLayout.CENTER); cc.show (c, "Main Page"); levelOne = new JPanel (); levelOne.setLayout (new GridBagLayout ()); levelOne.setBackground (Color.black); c.add (levelOne, "LevelOne"); JMenuBar menu = new JMenuBar (); JMenu file = new JMenu ("File"); JMenuItem exit = new JMenuItem ("Exit"); exit.addActionListener ( new ActionListener () { public void actionPerformed (ActionEvent event) { System.exit (0); } } ); file.add (exit); menu.add (file); setJMenuBar (menu); //Sets the size of the container (columns by rows) // setSize (750, 550); //Sets the location of the container setLocation (10, 10); //Sets the background colour to a dark blue colour // main.setBackground (Color.black); //Makes the container visible // setVisible (true); } public void paint (Graphics g) { super.paint (g); g.setColor (Color.white); l.label = "LevelOne"; if (l.label.equals ("LevelOne")) { l.LevelOne (g, levelOne); while (!l.ok) { try { synchronized (new Levels ()) { wait (); } } catch (InterruptedException e) { } } l.ok = false; } if (l.label != "MainMenu") repaint (); } public static void main (String[] args) { // calls the program // User_Interface application = new User_Interface (); application.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE); } //End of Main Method } //Libraries // import java.awt.*; import java.io.*; import javax.swing.*; import java.awt.event.*; public class Levels extends JFrame { public Color bgcolor; public Color darkGray = new Color (60, 60, 60); public int xLoc = 140; public int yLoc = 140; public int counter = -80; public int counter2 = 200; public String label = "MainMenu"; //static final String newline = System.getProperty ("line.separator"); public JButton up, down, left, right; public JTextArea ta; public Container c; public JFrame f = new JFrame (); public boolean perform; public JPanel one = new JPanel (); public boolean found = false; public boolean ok = false; public Graphics g; public GridBagConstraints gbc = new GridBagConstraints (); private JFrame frame = new JFrame (); { //Sets location, size, and visiblity to the frame where the JOptionPane //will be placed // frame.setLocation (600, 600); frame.setSize (1, 1); frame.setVisible (false); } JButton button1; public int xCord = 2; public int yCord = 2; public void LevelOne (Graphics g, JPanel one) { //********************************************************** //ROW SIX //********************************************************** // counter = -80; counter2 = 200; for (int a = 1 ; a <= 7 ; ++a) { if (xCord < a) { if (a == 1 || a == 4) g.setColor (darkGray); else g.setColor (Color.gray); g.fillRect (xLoc + counter, yLoc + 120, 40, 40); g.setColor (Color.black); g.drawRect (xLoc + counter, yLoc + 120, 40, 40); } if (xCord > a - 1) { if (a != 6) g.setColor (darkGray); else g.setColor (Color.gray); g.fillRect (xLoc + counter2, yLoc + 120, 40, 40); g.setColor (Color.black); g.drawRect (xLoc + counter2, yLoc + 120, 40, 40); } counter += 40; counter2 += 40; } up = new JButton ("UP"); left = new JButton ("LEFT"); right = new JButton (new ImageIcon ("RIGHT")); down = new JButton (new ImageIcon ("DOWN")); f.getContentPane ().setLayout (new BorderLayout ()); f.getContentPane ().add (up, BorderLayout.NORTH); f.getContentPane ().add (left, BorderLayout.WEST); f.getContentPane ().add (right, BorderLayout.EAST); f.getContentPane ().add (down, BorderLayout.SOUTH); f.pack (); f.setLocation (600, 350); f.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE); f.setVisible (true); KeyHandler key = new KeyHandler (); up.addKeyListener (key); left.addKeyListener (key); right.addKeyListener (key); down.addKeyListener (key); } private class KeyHandler implements KeyListener { public void keyPressed (KeyEvent ke) { if (ke.getKeyCode () == 37) { xCord -= 1; xLoc += 40; label = "LevelOne"; f.setVisible (false); ok = true; } else if (ke.getKeyCode () == 38) { yCord -= 1; yLoc += 40; label = "LevelOne"; f.setVisible (false); ok = true; } else if (ke.getKeyCode () == 39) { xCord += 1; xLoc -= 40; ok = true; label = "LevelOne"; f.setVisible (false); } else if (ke.getKeyCode () == 40) { yCord += 1; yLoc -= 40; label = "LevelOne"; f.setVisible (false); ok = true; } else { label = "LevelOne"; } } public void keyReleased (KeyEvent ke) { } public void keyTyped (KeyEvent ke) { } } }