Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extras: add new SlidePane #19

Merged
merged 8 commits into from
Nov 6, 2024
Merged

Extras: add new SlidePane #19

merged 8 commits into from
Nov 6, 2024

Conversation

DJ-Raven
Copy link
Owner

@DJ-Raven DJ-Raven commented Nov 6, 2024

This PR add new SlidePane component

Example

// create slidePane object
SlidePane slidePane = new SlidePane();

// add slide
slidePane.addSlide(new SimpleInputForms());

// add slide with transition type
slidePane.addSlide(new SimpleInputForms(), SlidePaneTransition.Type.FORWARD);

// add slide with transition type and animate duration
slidePane.addSlide(new SimpleInputForms(), SlidePaneTransition.Type.FORWARD, 500);

Transition type available

public enum Type {
    DEFAULT, BACK, FORWARD, ZOOM_IN, ZOOM_OUT, TOP_DOWN, DOWN_TOP
}

Custom slide transition

import raven.extras.SlidePaneTransition;

import java.awt.*;

public class CustomSlideTransition extends SlidePaneTransition {

    @Override
    public void renderImageOld(Graphics g, Image image, int width, int height, float animate) {
        // do render the old component image
    }

    @Override
    public void renderImageNew(Graphics g, Image image, int width, int height, float animate) {
        // do render the new component image
    }
}

Controll the slide layout

Make the slide child component to match the container's size.

// create slide layout size
PanelSlider.PaneSliderLayoutSize layoutSize = (container, component) -> container.getSize();

SlidePane slidePane = new SlidePane(layoutSize);

Make the slide child component's default preferred size for sliding.

// create slide layout size
PanelSlider.PaneSliderLayoutSize layoutSize = (container, component) -> component.getPreferredSize();

SlidePane slidePane = new SlidePane(layoutSize);

Demo added slide pane form

2024-11-06_234156

@DJ-Raven DJ-Raven merged commit 233e44a into main Nov 6, 2024
@DJ-Raven DJ-Raven added this to the 2.1.0 milestone Nov 6, 2024
DJ-Raven added a commit that referenced this pull request Nov 7, 2024
@DJ-Raven DJ-Raven deleted the slide-pane branch November 8, 2024 09:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant