每次获取dispose / setVisible(true)

时间:2016-04-28 06:59:12

标签: java swing size action jdialog

First time called

enter image description here

[10次召唤] [3]

enter image description here

经过多次交互后,JDialog结束于浮动标题栏。调整大小“重置”cicle。下面是JPanel中调用此JDialog的代码。不知道是什么让它变小了,只是在发出垃圾邮件后发现它。

public class Mant_presentacion extends JPanel implements ActionListener{

Boton buscar_envase = new Boton(this, new ImageIcon("lupa.png"));   
Mant_env envase = new Mant_env();   
public final JFrame OWNER;

public Mant_presentacion(JFrame OWNER){
    this.OWNER = OWNER;
    setLayout(null);
    setBackground(Color.WHITE);
    d = new JDialog(OWNER, "Seleccionar envase", true);
    buscar_envase.setBounds(500, 50, 180, 30);
    buscar_envase.setText(" Examinar envases");
    buscar_envase.addActionListener(this);
}

JDialog d;

@Override
public void actionPerformed(ActionEvent e) {
    d.setSize(envase.getWidth(), envase.getHeight());
    d.add(envase);
    d.setLocationRelativeTo(null);
    d.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
    d.setVisible(true);
}
}

1 个答案:

答案 0 :(得分:5)

    I see that you are using a ssh action and using a shell script which is conflicting. For executing a shell script you need to create a shell action which will be like this :

    <workflow-app name="WorkFlowForShellAction" xmlns="uri:oozie:workflow:0.3">
        <start to='shell' />
        <action name='shell'>
            <shell xmlns="uri:oozie:shell-action:0.1">
                <job-tracker>${jobTracker}</job-tracker>
                <name-node>${nameNode}</name-node>
                <configuration>
                    <property>
                      <name>mapred.job.queue.name</name>
                      <value>${queueName}</value>
                    </property>
                </configuration>
                <exec>${shellScriptPath}</exec>  
                <file>${shellScriptPath}#${shellscript}</file>                                                  
            </shell>
            <ok to="end" />
            <error to="fail" />
        </action>
        <kill name="fail">
            <message>Script failed, error message[${wf:errorMessage(wf:lastErrorNode())}]</message>
        </kill>
        <end name='end' />
    </workflow-app>
===============================================================
JOB.PROPERTIES
===============================================================

nameNode=hdfs://localhost:8020
jobTracker=localhost:8032
queueName=default
oozie.wf.application.path=${nameNode}/crazyoozie
focusNodeLogin=cloudera
shellScriptPath= /path/to/hdfs/script.sh
shellscript= script.sh


In the shellScriptPath give the hdfs path where you place the script

对话框周围有装饰。如果代码将对话框(d.setSize(envase.getWidth(), envase.getHeight()); )的大小设置为内容的大小(d),则每次都会缩小一点。

相关问题