登录
首页 » 其他 » Java实现窗体右键菜单

Java实现窗体右键菜单

于 2023-03-05 发布 文件大小:5.54 kB
0 122
下载积分: 2 下载次数: 1

代码说明:

Java实现窗体右键菜单,简约易操作的窗体菜单,这是一个相当易懂的制作实例。   super( "右键弹出菜单" ); //调用父类构造函数   ChangeColorAction action = new ChangeColorAction(); //菜单项事件处理   String[] str = {"Blue","Pink","Yellow","Red","Orange"}; //菜单项名称   ButtonGroup colorGroup=new ButtonGroup(); //实例化按钮组   popupMenu=new JPopupMenu(); //实例化弹出菜单   items=new JRadioButtonMenuItem[5]; //初始化数组   for (int i=0;i   items[i]=new JRadioButtonMenuItem(str[i]); //实例化菜单项    popupMenu.add(items[i]); //增加菜单项到菜单上    colorGroup.add(items[i]); //增加菜单项到按钮组    items[i].addActionListener(action); //菜单项事件处理   }   addMouseListener(new MouseAdapter(){ //窗口的鼠标事件处理    public void mousePressed( MouseEvent event ) { //点击鼠标    triggerEvent(event); //调用triggerEvent方法处理事件

下载说明:请别用迅雷下载,失败请重下,重下不扣分!

发表评论

0 个回复

  • VC.NET实现窗体动画
    VC.NET实现窗体动画,基于SonicUI引擎实现的UI动画,窗体可实现渐变渐入,内部元素可动画翻转,若要体现真正的动画效果,请下载源码后在VS下编译运行。
    2022-01-25 14:21:20下载
    积分:1
  • source code part for the carcasonne game
    source code part for the carcasonne game
    2022-08-14 13:35:56下载
    积分:1
  • 人在江湖(英文名订为“Emprise Online”以下简称EO)是一个纯中国武侠角色扮演游戏。人在江湖游戏的设计架构是以网络流行已久的文字MUD作为构想,希望...
    人在江湖(英文名订为“Emprise Online”以下简称EO)是一个纯中国武侠角色扮演游戏。人在江湖游戏的设计架构是以网络流行已久的文字MUD作为构想,希望能以最少的图形,让玩家可以从网站快速下载游戏而设计,所以图形丰富性上可能比不上一些线上游戏,因为设计构想是不一样的。-in the ring (English as "Emprise Online" hereinafter EO) is a pure Chinese martial arts role-playing game. The reason behind the game on the network structure design has long been the language MUD as a concept, hoping to be at least the graphics, allowing the player can be quickly downloaded from the website and game design, graphics richness may be behind some other online games, since the design concept is not the same.
    2022-10-10 13:05:03下载
    积分:1
  • 是一个用C语言编写的一个小游戏,大家可以下载回来交流学习一下啊...
    是一个用C语言编写的一个小游戏,大家可以下载回来交流学习一下啊-Is a C language with a small game, everyone can be downloaded back to the exchange of learning about ah
    2023-08-09 18:15:03下载
    积分:1
  • Java编写j2me五子棋游戏
    J2ME蓝牙五子棋游戏源代码,通过蓝牙连接对战,比较好玩的手机游戏,新手可以研究一下。代码片段:private Chess[][] chess; //棋子数组 private int player1win, player2win;    private MyCanvas mycanvas;    private int chessMapLength, chessMapGrid, chessGridLength;    //棋盘的边长,棋盘一边格子数,每格宽度    private int chessLength; //棋子的直径    private int chessMapX, chessMapY; //棋盘左上角x,y坐标    public static boolean myMove;    public boolean isServer;    private int selectedX, selectedY; //选择框在棋盘格局上的x,y位置   
    2022-01-28 10:20:39下载
    积分:1
  • Communication System Simulation, and AM, PSK modulation, etc., as well as other...
    通信系统仿真,有AM,PSK等调制,还有其他文件(system环境下),是仿真文件-Communication System Simulation, and AM, PSK modulation, etc., as well as other documents (system environment)
    2023-07-17 13:35:03下载
    积分:1
  • The book for the device drivers under LINUX materials, detailed and very useful
    本书为LINUX下设备驱动程序的教材,内容详细,非常实用-The book for the device drivers under LINUX materials, detailed and very useful
    2022-03-24 14:06:24下载
    积分:1
  • This specification defines the Audio Codec ‘97 (AC ‘97) Architecture and Digital...
    This specification defines the Audio Codec ‘97 (AC ‘97) Architecture and Digital Interface (AC-link) specifically designed for implementing audio and modem I/O functionality in mainstream PC systems. This specification does not explicitly define the companion AC ‘97 Digital Controller component (sometimes referred to or abbreviated as DC ‘97), which typically varies in features and implementation, but is AC ‘97 compliant with this specification.-This specification defines the Audio Codec
    2022-05-06 15:37:40下载
    积分:1
  • 非常好玩的游戏。网上收集。只提供参考。下载后24小时内删除...
    非常好玩的游戏。网上收集。只提供参考。下载后24小时内删除-very fun game. Online collection. For information only. After downloading deleted within 24 hours
    2022-05-28 15:20:49下载
    积分:1
  • 凌阳DVD编辑软件LOGO
    sunplus dvd logo editer software
    2022-03-24 04:36:58下载
    积分:1
  • 696518资源总数
  • 105877会员总数
  • 14今日下载