首页
网站首页
公司简介
资讯中心
推荐内容
返回顶部
倒水问题,单词拼写www.64222.com
发布时间:2020-01-05 13:33
浏览次数:

三个12L、8L、5L的无刻度杯子,12L的已装满水,怎样倒可以倒出2个6L的水

可以写入脚本中干掉进程等方法一:
核实获取到的id号,以核实是否正确
[root@f5ha.com ~]# ps -ef |grep -v 'grep '| grep httpd  | awk '$3 ~ /[0-9]+/ {print $3}' | while read s; do echo $s; done
核实后杀掉进程即可
[root@f5ha.com ~]# ps -ef |grep -v 'grep '| grep httpd  | awk '$3 ~ /[0-9]+/ {print $3}' | while read s; do kill -9  $s;  done方法二:
核实获取到的id号,以核实是否正确
[root@f5ha.com ~]# ps axu |grep -v 'grep' |egrep "httpd"|awk '{system("echo "$2)}'
核实后杀掉进程即可
[root@f5ha.com ~]# ps axu |grep -v 'grep' |egrep "httpd"|awk '{system("kill -9 "$2)}'注释:
grep -v grep(过滤掉本语句本身的进程)
这句是必须加的要不然脚本会先杀死自己,然后就不会去执行杀死其他的进程了。

import java.awt.*;
import java.awt.event.*;

import java.util.Calendar;

12L的杯子为:a12,8L的杯子为:b8,5L的杯子为:c5.输出每次倒水后,每个杯子中水的容量。

public class LetterLabel extends Button implements FocusListener,
MouseListener{
    //构造器
    LetterLabel(){
        addFocusListener(this); //将当前对象注册为自身的焦点事件监视器
        addMouseListener(this); //将当前对象注册为自身的鼠标事件监视器
        
        this.setBackground(Color.cyan);//青色
        this.setFont(new Font("",Font.BOLD,32));//字体
    }
    public static LetterLabel[] getLetterLabel(int n){
        LetterLabel a[]=new LetterLabel[n];
        for (int i = 0; i<a.length; i++){
            a[i]=new LetterLabel();
        }
        return a;
    }
    
    public void focusGained(FocusEvent e){
        this.setBackground(Color.red);
    }
    public void focusLost(FocusEvent e){
        this.setBackground(Color.cyan);
    }
    
    public void mousePressed(MouseEvent e){
        this.requestFocus();
    }
/*???????????????????????????????????????????*/    
    public void setText(char c){
        setLabel(""+c);
    }
    public char[] getText(){
        return getLabel().toCharArray();
    }
/*???????????????????????????????????????????*/        
    public void mouseClicked(MouseEvent e){}
    public void mouseReleased(MouseEvent e){}
    public void mouseEntered(MouseEvent e){}    
    public void mouseExited(MouseEvent e){}
}

public class MyCalendar{
    String[] day;
    int year=2005,month=0;
    public void setYear(int year){
        this.year=year;
    }
    public int getYear(){
        return year;
    }
    public void setMonth(int month){
        this.month=month;
    }
    public int getMonth(){
        return month;
    }
    public String[] getCalendar(){
        String[] a = new String[42];
        Calendar 日历=Calendar.getInstance();
        日历.set(year,month-1,1);
        int 星期几=日历.get(Calendar.DAY_OF_WEEK)-1;
        int day=0;
        if(month==1||month==3||month==5||month==7||month==8||month==10||month==12){
            day=31;
        }else if(month==4||month==6||month==9||month==11){
            day=30;
        }else if(month==2){
            if(((year%4==0)&&(year%100!=0))||(year%400==0)){
                day=29;
            }else{
                day=28;
            }
        }
        for (int i = 星期几,n=1; i<星期几+day; i++){
            a[i]=String.valueOf(n);
            n++;
        }
        return a;
    }
}

a12   b8   c5

 

 

 12    0     0

/*产生随机字符组合*/
public class RondomString{
    String str="";
    //获取字符串
    public String getRondomString(String s){
        StringBuffer strBuffer=new StringBuffer(s);
        int m=strBuffer.length();//字符串的长度
        for (int i = 0; i<m; i++){
            int index=(int)(Math.random()*strBuffer.length());
            char c=strBuffer.charAt(index);
            str+=c;
            //移除此序列指定位置的 char。此序列将缩短一个 char。
            strBuffer=strBuffer.deleteCharAt(index);
        }
        return str;
    }
}

import java.util.*;
import java.awt.*;
import java.awt.event.*;
import java.applet.*;

  ..............

 

public class CalendarFrame extends Frame implements ActionListener{
    Label[] labelDay=new Label[42];
    Button[] titleName=new Button[7];
    String[] name={"日","一","二","三","四","五","六"};
    Button nextMonth,previousMonth;
    int year=2006,month=10;
    MyCalendar calendar;
    Label showMessage=new Label("",Label.CENTER);
    
    public CalendarFrame(){
        Panel pCenter=new Panel();
        pCenter.setLayout(new GridLayout(7,7)); //将pCenter的布局设置为7行7列的GridLayout布局
        for (int i = 0; i<7; i++){
            titleName[i]=new Button(name[i]);
            pCenter.add(titleName[i]);
            //pCenter添加组件titleName[i]
        }
        for (int i = 0; i<42; i++){
倒水问题,单词拼写www.64222.com。            labelDay[i]=new Label("",Label.CENTER);
            pCenter.add(labelDay[i]);
            //pCenter添加组件LabelDay[i]
        }
        
        calendar=new MyCalendar();
        calendar.setYear(year);
        calendar.setMonth(month);
        String[] day=calendar.getCalendar();
        for (int i = 0; i<42; i++){
            labelDay[i].setText(day[i]);
        }
        nextMonth=new Button("下月");
        previousMonth=new Button("上月");
        nextMonth.addActionListener(this);
        previousMonth.addActionListener(this);
        Panel pNorth=new Panel(),
                pSouth=new Panel();
        pNorth.add(previousMonth);
        pNorth.add(nextMonth);
        pSouth.add(showMessage);
        showMessage.setText("日历:"+calendar.getYear()+"年"+
                        calendar.getMonth()+"月");
        ScrollPane scrollPane=new ScrollPane();
        scrollPane.add(pCenter);
        add(scrollPane,BorderLayout.CENTER);//在窗口中心区域添加scrollPane
        add(pNorth,BorderLayout.NORTH);//在窗口北面区域添加pNorth
        add(pSouth,BorderLayout.SOUTH);//在窗口南面区域添加pSouth
    }
    public void actionPerformed(ActionEvent e){
        if(e.getSource()==nextMonth){
            month=month+1;
            if(month>12)
                month=1;
            calendar.setMonth(month);
            String[] day=calendar.getCalendar();
            for (int i = 0; i<42; i++){
                labelDay[i].setText(day[i]);
            }
        }else if(e.getSource()==previousMonth){
            month--;
            if(month<1)
                month=12;
            calendar.setMonth(month);
            String[] day=calendar.getCalendar();
            for (int i = 0; i<42; i++){
                labelDay[i].setText(day[i]);
            }
        }
        showMessage.setText("日历:"+calendar.getYear()+"年"+
                        calendar.getMonth()+"月");
    }
}

  ..............

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

 

  6     6    0

public class SpellingWordFrame extends Frame implements KeyListener,
ActionListener{
    //组件声明
    TextField inputWord;
    Button button;
    LetterLabel label[];
    Panel northP,centerP;
    Box wordBox;
    String hintMessage="用鼠标单击字母。按左右键交换字母,将其排列成所输入的单词";
    Label messageLabel=new Label(hintMessage);
    String word="";
    
    //构造器
    SpellingWordFrame(){
        inputWord=new TextField(12);
        button=new Button("确定");
        button.addActionListener(this);//注册事件监听器
        inputWord.addActionListener(this);
        
        //北区面板
        northP=new Panel();
        northP.add(new Label("输入一个英文单词"));
        northP.add(inputWord);
        northP.add(button);
        //中区面板
        centerP=new Panel();
        wordBox=Box.createHorizontalBox();//创建水平Box
        centerP.add(wordBox);
        
        //整个窗体布局设置
        this.add(northP,BorderLayout.NORTH);
        this.add(centerP,BorderLayout.CENTER);
        this.add(messageLabel,BorderLayout.SOUTH);
        //设置坐标和大小
        this.setBounds(200,200,350,180);
        this.setVisible(true);//可见
        this.validate();//验证此容器及其所有子组件。
        
        //响应关闭按钮
        addWindowListener(new WindowAdapter(){
                public void windowClosing(WindowEvent e){
                    System.exit(0);
                }
            });
        
    }
    
    //运行时执行下面的操作
    public    void actionPerformed(ActionEvent e){
        word=inputWord.getText();//获取文本中的字符
        int n=word.length();//把字符串的长度赋值给n
        RondomString rondom=new RondomString();
        String randomWord=rondom.getRondomString(word);
        wordBox.removeAll();
        messageLabel.setText(hintMessage);
        
        if(n>0){
            label=LetterLabel.getLetterLabel(n);
            for (int i = 0; i<label.length; i++){
                label[i].addKeyListener(this); //讲当前窗口注册为label[i]的键盘监视器
                label[i].setText(randomWord.charAt(i));  //
                   wordBox.add(label[i]);

public class CalendarMainClass{
    
    public static void main(String[] agrs){
        CalendarFrame frame = new CalendarFrame();
        frame.setBounds(100,100,360,300);
        frame.setVisible(true);
        frame.validate();
        frame.addWindowListener(new java.awt.event.WindowAdapter(){
            public void windowClosing(java.awt.event.WindowEvent e){
                System.exit(0);
            }
        });        
    }
}

友情链接: 网站地图
Copyright © 2015-2019 http://www.nflfreepicks.net. 新葡萄京娱乐场网址有限公司 版权所有