java中Jcombobox的用法?

来源:百度知道 编辑:UC知道 时间:2024/07/07 02:51:50
如何使用JcomboBox组件来实现级联效果,例如:总公司有多个子公司,公司1,公司2...;公司1有多个部门:采购,生产部,销售部...;公司2有多个部门:行政,采购,生产,销售...。使用MSSQL数据库,Company表存储公司信息,有三个字段:id(主键),name(公司名称),upper(上级公司编号);department存储部门信息,有四个字段,id(主键),name(部门名称),upper(上级部门编号),ssgs(所属公司)。SQL脚本为:if exists (select 1
from dbo.sysreferences r join dbo.sysobjects o on (o.id = r.constid and o.type = 'F')
where r.fkeyid = object_id('department') and o.name = 'FK_DEPARTME_REFERENCE_COMPANY')
alter table department
drop constraint FK_DEPARTME_REFERENCE_COMPANY
go

if exists (select 1
from sysobjects
where id = object_id('Company')
and type = 'U')
drop table Company
go

if exists (select 1
from sysobjects
where id = object_id('department')
and type = 'U')
drop table department
go
create table Company (
id

可以这样啊,先把公司添加到第一个中!然后对第一个添加监听,选择了哪个公司就在第二个中在添加所选公司的部门!
不知楼主对这种方法满意呢?我都是这样用的啊!

没有人愿意试试吗??
同情一下