popup java_Java:Popup不总是可见的

我使用Popup来显示更新进度。我在主窗口上方放置了一块半透明面板。在大多数情况下,Popup是可见的,但在某些计算机上却不是。它似乎与特定的计算机有关。有谁知道解决方案还是有更好的方法来实现?

//Disable main components

tabs.setEnabledAt(0, false);

tabs.setEnabledAt(1, false);

comPorts_CB.setEnabled(false);

getinfo_B.setEnabled(false);

//Add effect panel

pop_effect_panel = new JPanel();

pop_effect_panel.setBackground(new Color(255, 255, 255, 192));

pop_effect_panel.setBounds(0, 0, 1000, 1000);

pop_effect_panel.setLayout(null);

pop_effect_panel.setOpaque(true);

getContentPane().add(pop_effect_panel);

getContentPane().setComponentZOrder(pop_effect_panel, 0);

getContentPane().setEnabled(false);

pop_effect_panel.invalidate();

//Create pop-up panel

pop_panel = new JPanel();

pop_panel.setBackground(BACKGROUND_COLOR);

pop_panel.setSize(300, 300);

pop_panel.setLayout(null);

pop_panel.setOpaque(true);

pop_panel.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED));

pop_progress_TA = new NonSelectableTextArea();

pop_progress_TA.setBounds(2, 2, 296, 268);

pop_progress_TA.setBackground(BACKGROUND_COLOR);

pop_panel.add(pop_progress_TA);

pop_progress_bar = new JProgressBar();

pop_progress_bar.setBounds(1, 270, 240, 28);

pop_progress_bar.setValue(0);

pop_progress_bar.setStringPainted(true);

pop_progress_bar.setString("");

pop_panel.add(pop_progress_bar);

pop_ok_B = new JButton("OK");

pop_ok_B.setBounds(241, 270, 57, 28);

pop_ok_B.setEnabled(false);

pop_panel.add(pop_ok_B);

final Popup popup = PopupFactory.getSharedInstance().getPopup(getContentPane(), pop_panel, 100, 250);

popup.show();

pop_ok_B.addActionListener(new ActionListener() {

@Override

public void actionPerformed(ActionEvent e) {

popup.hide();

//Remove effect panel

getContentPane().remove(pop_effect_panel);

getContentPane().validate();

//Enable main components

tabs.setEnabledAt(0, true);

tabs.setEnabledAt(1, true);

comPorts_CB.setEnabled(true);

getinfo_B.setEnabled(true);

}

});

pop_progress_TA.requestFocusInWindow();

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
<androidx.constraintlayout.widget.ConstraintLayout android:id="@+id/listinfo" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@drawable/round_style" android:elevation="4dp" android:layout_margin="8dp" android:clickable="true" android:padding="10dp"> <com.xuexiang.xui.widget.textview.autofit.AutoFitTextView android:id="@+id/code" style="@style/item_show_title" android:layout_width="14dp" android:layout_height="16dp" android:paddingTop="2dp" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> <com.xuexiang.xui.widget.textview.autofit.AutoFitTextView style="@style/item_show_title" android:id="@+id/name" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/code"/> <com.xuexiang.xui.widget.textview.autofit.AutoFitTextView style="@style/item_show_title" android:id="@+id/spec" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/name"/> <com.xuexiang.xui.widget.textview.autofit.AutoFitTextView style="@style/item_show_title" android:id="@+id/composition" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/spec"/> <com.xuexiang.xui.widget.textview.autofit.AutoFitTextView style="@style/item_show_title" android:id="@+id/weight" app:layout_constraintStart_toEndOf="@+id/composition" app:layout_constraintTop_toBottomOf="@+id/spec"/> <ImageView android:id="@+id/status" android:layout_width="wrap_content" android:layout_height="wrap_content" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toBottomOf="@+id/name" app:layout_constraintTop_toTopOf="parent" /> <View style="@style/item_show" android:id="@+id/view_task_list" android:layout_width="match_parent" android:layout_height="1dp" android:background="#cccccc" android:layout_marginTop="3dp" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toBottomOf="@+id/composition" app:layout_constraintStart_toStartOf="@+id/composition"/> </androidx.constraintlayout.widget.ConstraintLayout>点击表格,显示弹窗展示列内容
最新发布
06-04

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值