JSplitButton

Swing implementation of a split button and JavaBean information for using it in an IDE.

Лицензия

Лицензия

Категории

Категории

Jakarta Server Pages Jakarta EE The Web Tier
Группа

Группа

com.alexandriasoftware.swing
Идентификатор

Идентификатор

jsplitbutton
Последняя версия

Последняя версия

1.3.1
Дата

Дата

Тип

Тип

jar
Описание

Описание

JSplitButton
Swing implementation of a split button and JavaBean information for using it in an IDE.
Ссылка на сайт

Ссылка на сайт

https://rhwood.github.io/jsplitbutton
Система контроля версий

Система контроля версий

https://github.com/rhwood/jsplitbutton

Скачать jsplitbutton

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/com.alexandriasoftware.swing/jsplitbutton/ -->
<dependency>
    <groupId>com.alexandriasoftware.swing</groupId>
    <artifactId>jsplitbutton</artifactId>
    <version>1.3.1</version>
</dependency>
// https://jarcasting.com/artifacts/com.alexandriasoftware.swing/jsplitbutton/
implementation 'com.alexandriasoftware.swing:jsplitbutton:1.3.1'
// https://jarcasting.com/artifacts/com.alexandriasoftware.swing/jsplitbutton/
implementation ("com.alexandriasoftware.swing:jsplitbutton:1.3.1")
'com.alexandriasoftware.swing:jsplitbutton:jar:1.3.1'
<dependency org="com.alexandriasoftware.swing" name="jsplitbutton" rev="1.3.1">
  <artifact name="jsplitbutton" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.alexandriasoftware.swing', module='jsplitbutton', version='1.3.1')
)
libraryDependencies += "com.alexandriasoftware.swing" % "jsplitbutton" % "1.3.1"
[com.alexandriasoftware.swing/jsplitbutton "1.3.1"]

Зависимости

test (2)

Идентификатор библиотеки Тип Версия
junit : junit jar 4.12
org.hamcrest : hamcrest-core jar 1.3

Модули Проекта

Данный проект не имеет модулей.

JSplitButton

A split button control for Java Swing.

Maven Central Javadocs Build Status Coverage Status Maintainability Test Coverage

A simple implementation of the split button control for Java Swing. This control raises two events:

  • buttonClicked(ActionEvent e)
  • splitButtonClicked(ActionEvent e)

The buttonClicked event is raised when the main, or left, part of the button is clicked, which will not trigger the popup menu. The splitButtonClicked event is raised when the split, or right, part of the button is clicked and displays a popup menu.

To handle these events you need a listener that implements:

  • SplitButtonActionListener to handle both events in a single listener
  • ButtonClickedActionListener to handle just buttonClicked
  • SplitButtonClickedActionListener to handle just splitButtonClicked

See also http://naveedmurtuza.blogspot.ch/2010/11/jsplitbutton.html

Screenshots

alt tag

alt tag

alt tag

Using the Control

//first instantiate the control
JSplitButton splitButton = new JSplitButton();
//register for listener
splitButton.addSplitButtonActionListener(new SplitButtonActionListener() {

    public void buttonClicked(ActionEvent e) {
        System.out.println("Button Clicked");
    }

    public void splitButtonClicked(ActionEvent e) {
        System.out.println("Split Part Clicked");
    }
});
//add popup menu
splitButton.add(popupMenu);
//add this control to panel
panel.add(splitButton);

or (using Java 8 lambda expressions):

//first instantiate the control
JSplitButton splitButton = new JSplitButton();
//register for button listener
splitButton.addButtonClickedActionListener((ActionEvent e) -> {
    System.out.println("Button Clicked");
});
//register for split button listener
splitButton.addSplitButtonClickedActionListener((ActionEvent e) -> {
    System.out.println("Split Part Clicked");
});
//add popup menu
splitButton.add(popupMenu);
//add this control to panel
panel.add(splitButton);

Prior History

Версии библиотеки

Версия
1.3.1
1.3.0