Re: Alternative for deprecated method

Mike a écrit :
I'm messing around with Java Swing. I'm also messing around with
Eclipse instead of a plain text editor such as TextPad.

When I create the following two classes in Eclipse, I get a persistent
warning that

The method show() from the type Window is deprecated

But I've checked the API docs (hence my looking for the 1.5.0 docs) and
it does NOT indicate that show() is deprecated. Any words of


import javax.swing.*;

public class LoanCalculatorApp
	public static void main(String[] args)
		JFrame frame = new LoanCalculatorFrame();;

import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.text.*;

public class LoanCalculatorFrame extends JFrame { public LoanCalculatorFrame() { setTitle("Loan Calculator"); Toolkit tk = Toolkit.getDefaultToolkit(); Dimension d = tk.getScreenSize(); System.out.println("Screen:" + d.width + " by " + d.height + " pixels"); int height = 200; int width = 267; setBounds((d.width-width)/2, (d.height-height)/2, width, height); setResizable(false); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); Container contentPane = getContentPane(); JPanel panel = new JPanel(); contentPane.add(panel);


in Swing components .show() is replaced by .setVisible(true) or ..setVisible(false).
to show or hide the component.