2010-07-11
展开全部
public class test2
{
public static void main(String[] args){
String sName[]= new String[]{"c","b","a","d","e"};
//输出上面的三行
for(int i = 2; i >= 0; i--)
{
for(int j = 0; j < i ; j++)
{
System.out.print(" ");
}
for(int n = 0; n < 5 - 2 * i; n++)
{
System.out.print(sName[i]);
}
System.out.println("");
}
//输出下面的两行
for(int i = 1; i < 3; i ++)
{
for(int j = 0; j < i ; j++)
{
System.out.print(" ");
}
for(int n = 0; n < 5 - 2 * i; n++)
{
System.out.print(sName[i+2]);
}
System.out.println("");
}
}
}
{
public static void main(String[] args){
String sName[]= new String[]{"c","b","a","d","e"};
//输出上面的三行
for(int i = 2; i >= 0; i--)
{
for(int j = 0; j < i ; j++)
{
System.out.print(" ");
}
for(int n = 0; n < 5 - 2 * i; n++)
{
System.out.print(sName[i]);
}
System.out.println("");
}
//输出下面的两行
for(int i = 1; i < 3; i ++)
{
for(int j = 0; j < i ; j++)
{
System.out.print(" ");
}
for(int n = 0; n < 5 - 2 * i; n++)
{
System.out.print(sName[i+2]);
}
System.out.println("");
}
}
}
展开全部
public class test1
{
public test1()
{
}
public static void main(String[] args)
{
char c = 'a';
for (int i = 0; i < 2; i++)
{
for (int j = 0; j < 2-i; j++)
{
System.out.print(" ");
}
for (int j = 0; j < 2*i + 1; j++)
{
System.out.print(c);
}
c++;
System.out.println();
}
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < i; j++)
{
System.out.print(" ");
}
for (int j = 0; j < 5-2*i; j++)
{
System.out.print(c);
}
c++;
System.out.println();
}
}
}
{
public test1()
{
}
public static void main(String[] args)
{
char c = 'a';
for (int i = 0; i < 2; i++)
{
for (int j = 0; j < 2-i; j++)
{
System.out.print(" ");
}
for (int j = 0; j < 2*i + 1; j++)
{
System.out.print(c);
}
c++;
System.out.println();
}
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < i; j++)
{
System.out.print(" ");
}
for (int j = 0; j < 5-2*i; j++)
{
System.out.print(c);
}
c++;
System.out.println();
}
}
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
写几条输出语句就完了,例如
System.out.println(" a");
System.out.println(" bbb");
System.out.println("ccccc");
System.out.println(" ddd");
System.out.println(" e");
System.out.println(" a");
System.out.println(" bbb");
System.out.println("ccccc");
System.out.println(" ddd");
System.out.println(" e");
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
package com.frame;
import java.applet.Applet;
import java.awt.AWTException;
import java.awt.Rectangle;
import java.awt.Robot;
import java.awt.Toolkit;
import java.awt.image.BufferedImage;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
public class A extends Applet
{
/**
*
*/
private static final long serialVersionUID = 1L ;
@Override
public void init()
{
super.init();
new MainFrame();
}
@Override
public void start()
{
super.start();
}
public class MainFrame extends JFrame
{
/**
*
*/
private static final long serialVersionUID = 1L;
private JFrame frame;
private final int WIDTH;
private final int HEIGHT;
private JLabel label;
private Robot robot;
private Rectangle rect;
private BufferedImage buffeimage;
/**
* 构造方法
*/
public MainFrame()
{
frame = this;
label = new JLabel();
frame.add(label);
WIDTH=Toolkit.getDefaultToolkit().getScreenSize().width;
HEIGHT= Toolkit.getDefaultToolkit().getScreenSize().height;
frame.setUndecorated(true);
frame.getGraphicsConfiguration().getDevice().setFullScreenWindow(frame);
try
{
robot = new Robot();
rect = new Rectangle(0,0,WIDTH,HEIGHT);
buffeimage = robot.createScreenCapture(rect);
label.setIcon(new ImageIcon(buffeimage));
}
catch (AWTException e)
{
e.printStackTrace();
}
frame.setSize(WIDTH,HEIGHT);
frame.setVisible(true);
}
}
}
import java.applet.Applet;
import java.awt.AWTException;
import java.awt.Rectangle;
import java.awt.Robot;
import java.awt.Toolkit;
import java.awt.image.BufferedImage;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
public class A extends Applet
{
/**
*
*/
private static final long serialVersionUID = 1L ;
@Override
public void init()
{
super.init();
new MainFrame();
}
@Override
public void start()
{
super.start();
}
public class MainFrame extends JFrame
{
/**
*
*/
private static final long serialVersionUID = 1L;
private JFrame frame;
private final int WIDTH;
private final int HEIGHT;
private JLabel label;
private Robot robot;
private Rectangle rect;
private BufferedImage buffeimage;
/**
* 构造方法
*/
public MainFrame()
{
frame = this;
label = new JLabel();
frame.add(label);
WIDTH=Toolkit.getDefaultToolkit().getScreenSize().width;
HEIGHT= Toolkit.getDefaultToolkit().getScreenSize().height;
frame.setUndecorated(true);
frame.getGraphicsConfiguration().getDevice().setFullScreenWindow(frame);
try
{
robot = new Robot();
rect = new Rectangle(0,0,WIDTH,HEIGHT);
buffeimage = robot.createScreenCapture(rect);
label.setIcon(new ImageIcon(buffeimage));
}
catch (AWTException e)
{
e.printStackTrace();
}
frame.setSize(WIDTH,HEIGHT);
frame.setVisible(true);
}
}
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询