combobox

201771010128王玉兰《面向对象程序设计(Java)》课程学习总结

不羁的心 提交于 2020-05-01 04:37:01
1 、实验目的与要求 (1) 综合掌握java基本程序结构; (2) 综合掌握java面向对象程序设计特点; (3) 综合掌握java GUI 程序设计结构; (4) 综合掌握java多线程编程模型; (5) 综合编程练习。 2 、实验内容和步骤 任务1:填写课程课后调查问卷,网址:https://www.wjx.cn/jq/33108969.aspx。 任务2:综合编程练习 练习1:设计一个用户信息采集程序,要求如下: (1) 用户信息输入界面如下图所示: (1)用户点击提交按钮时,用户输入信息显示控制台界面; (2)用户点击重置按钮后,清空用户已输入信息; (3)点击窗口关闭,程序退出。 import java.awt.*; import javax.swing.*; public class DemoJFrame extends JFrame { private JPanel jPanel1; private JPanel jPanel2; private JPanel jPanel3; private JPanel jPanel4; private JTextField fieldname; private JComboBox comboBox; private JTextField fieldadress; private ButtonGroup bg; private

How to avoid closing popup menu on mouse clicking in javafx combobox?

久未见 提交于 2020-04-30 02:50:28
问题 I have combobox with custom ListCell: private class SeverityCell extends ListCell<CustomItem> { private final CustomBox custombox; { setContentDisplay(ContentDisplay.GRAPHIC_ONLY); custombox = new CustomBox(); } @Override protected void updateItem(CustomItem item, boolean empty) { super.updateItem(item, empty); if (null != item) { //... } setGraphic(custombox); } } and combobox.setCellFactory(new Callback<ListView<CustomItem>, ListCell<CustomItem>>() { @Override public ListCell<CustomItem>

《深入浅出WPF》学习总结之控件与布局

会有一股神秘感。 提交于 2020-04-28 18:49:45
一、控件到底是什么   控件的本质是“数据+算法”——用户输入原始数据,算法处理原始数据并得到结果数据。问题就在于程序如何将结果数据展示给用户。同样一组数据,你可以使用LED阵列显示出来,或者是以命令行模式借助各种控制字符(如Tab)对其并输出,但这些都不如图形化用户界面(Graphics User Interface ,GUI)来的友好和方便。GUI是程序界的优胜者,但在Windows上实现图形化界面有很多中方法。每种方法又拥有自己的一套开发理念和工具。每种GUI开发与它的里理念和工具共同组成一种方法论。常见的有: Windows API (Win API):调用Windows底层绘图函数,使用C语言,最原始也最基础。 Microsoft Foundation Class(MFC):使用C++语法将原始的Win32 API封装成控件类。 Visual Component Library(VCL):Delphi 和C++Builder使用的与MFC相近的控件类库 Vistal Basic+ActiveX控件(VB6):使用组件化的思想把Win API 封装成UI控件,已其多语言共用 Java Swing/AWT:Java SDK中用于跨平台开发GUI程序的控件类库 Windows Form:.NET平台上进行GUI开发的老牌劲旅,完全组件化但需要.NET运行时支持。 Windows

[WPF 自定义控件]了解如何自定义ItemsControl

元气小坏坏 提交于 2020-04-27 22:43:30
1. 前言 对WPF来说ContentControl和 ItemsControl 是最重要的两个控件。 顾名思义,ItemsControl表示可用于呈现一组Item的控件。大部分时候我们并不需要自定义ItemsControl,因为WPF提供了一大堆ItemsControl的派生类:HeaderedItemsControl、TreeView、Menu、StatusBar、ListBox、ListView、ComboBox;而且配合Style或DataTemplate足以完成大部分的定制化工作,可以说ItemsControl是XAML系统灵活性的最佳代表。不过,既然它是最常用的控件,那么掌握一些它的原理对所有WPF开发者都有好处。 我以前写过 一篇文章 介绍如何模仿ItemsControl,并且博客园也已经很多文章深入介绍ItemsControl的原理,所以这篇文章只介绍简单的自定义ItemsControl知识,通过重写GetContainerForItemOverride和IsItemItsOwnContainerOverride、PrepareContainerForItemOverride函数并使用ItemContainerGenerator等自定义一个简单的IItemsControl控件。 2. 介绍作为例子的Repeater

Java开发笔记(一百四十)JavaFX的选择框

天大地大妈咪最大 提交于 2020-04-24 04:52:04
与Swing一样,JavaFX依然提供了三种选择框,它们是复选框CheckBox、单选按钮RadioButton、下拉框ComboBox,分别说明如下: 一、复选框CheckBox 复选框允许同时勾选多个,已勾选的时候在方框内部打个勾,未勾选的时候显示空心方框。查看CheckBox的源码,发现它与Button控件都派生自抽象类ButtonBase,因而CheckBox拥有和Button同样的set***/get***方法。不同之处主要有以下两点: 1、关于勾选状态的设置与判断:调用setSelected方法可以设置复选框的勾选状态,调用isSelected方法可以判断复选框是否被勾选了。 2、关于勾选监听器的设置:先调用selectedProperty方法获得复选框的属性对象,再调用属性对象的addListener方法设置该复选框的勾选监听器。下面是给复选框设置单击监听器的代码例子: CheckBox ck = new CheckBox("满意"); // 创建一个复选框 ck.selectedProperty().addListener(new ChangeListener<Boolean>() { // 设置复选框的勾选监听器 @Override public void changed(ObservableValue<? extends Boolean> arg0,

软件快速开发平台设计思路及实现方法(二)

六眼飞鱼酱① 提交于 2020-04-18 08:43:03
接上篇内容描述谈谈平台设计思路及方法。前一篇简单的介绍了一下整体的实现思路。那从本节开始开始说明如何引入数据库表视图等,因为我们不管做什么项目软件,设计的时候能直接将页面控件绑定到指定的字段,那样后续的操作就会很方便。至于实现的方法,有很多种,每个人可能有各自不同的思路,我不去评价别人是怎么做的,仅说说我自己的实现思路,因为这个思路在后续的实际使用中,经过很多大型项目的验证,的确是可行的,但并不代表此实现的方式是最好、最完善的,肯定有很多不足之处,说实话,技术有限,不可能满足实现所有人的想法。 数据集合 :引入此概念,目的是实现我们在数据库中的表、视图的映射,为什么叫映射呢,因为它只是起到一个中转作用,自身不实现什么其他的功能。 因为是设计开发工具,那么使用者肯定包含不同层次的开发者,例如刚毕业的学生等等,一套软件项目一般都是经过多个人员协同分工来实现的,那我们肯定要对这些分工做一个规则的制定,让所有参与的人员都能明白前一步操作人员设计的意图和含义,这样就省去了很长时间的理解消化。 表、视图在数据库中是可以直接建立完成,但是我想在页面设计中使用,那么肯定需要从数据库中获取表或视图来绑定使用。一般来说我直接调用表、视图不行吗?不是也能实现这样的功能吗?答案是肯定的,可以那么做,但是如果表是A员工做的,B员工设计页面,他需要调用表,但是表结构的字段直接查看是无法知道是什么含义的

How to control the values of other comboboxes using the value selected in first combobox in python gui?

爱⌒轻易说出口 提交于 2020-04-18 05:45:39
问题 I have been coding in python for the past 15 days...I need a small help with my code... the script which takes any excel sheet(.xlsx) as input and generates the first filled row as dropdown buttons with the same name and it also lists the values of the corresponding columns in that dropdown button. I have created the dropdown buttons using Combobox and i have created them using for loop. The problem is i am able to control only the lastly created Combobox. What i need is...in the first

Show combobox drop down while editing text using tkinter

北战南征 提交于 2020-04-15 20:19:56
问题 Is it possible to make Combobox editable while dropdown is opened? I haven't found any solution. I want to make it more like Google Search but using ComboBox. 回答1: Question : Show Combobox PopdownWindow, while editing text This example extends a ttk.Combobox to the following: Show the PopdownWindow while typing Open the PopdownWindow on Key-pressed '<Down>' Close the PopdownWindow on Key-pressed '<Up' , if at the first item in the Listbox Reference : Events and Bindings For each widget, you

Show combobox drop down while editing text using tkinter

孤街浪徒 提交于 2020-04-15 20:16:12
问题 Is it possible to make Combobox editable while dropdown is opened? I haven't found any solution. I want to make it more like Google Search but using ComboBox. 回答1: Question : Show Combobox PopdownWindow, while editing text This example extends a ttk.Combobox to the following: Show the PopdownWindow while typing Open the PopdownWindow on Key-pressed '<Down>' Close the PopdownWindow on Key-pressed '<Up' , if at the first item in the Listbox Reference : Events and Bindings For each widget, you

Check if combobox value is empty

醉酒当歌 提交于 2020-04-08 09:55:34
问题 I have created a ComboBox with three values. I wanted that a message box opens when no item is selected so I tried this: if (comboBox1.SelectedItem == null) { MessageBox.Show("Please select a value"); return; } That works fine but only if I click into the field in the combobox. When I dont touch it, the program will start without message box. Whats wrong? 回答1: if (string.IsNullOrEmpty(comboBox1.Text)) or if (comboBox1.SelectedIndex == -1) 回答2: Use if (comboBox1.SelectedIndex == -1) {