jasonw749 0 Newbie Poster

So, i have made a small test application attempting to learn and get used to the Trident library. I use a Timeline to alter the position of a JPanel. I was really impressed with how well it worked, until i added a background color to the moving panel, its all fun and games, until you use alpha!

Its such a strange issue, on the way up, the panel goes completely opaque, but then on the way back down, it gets its correct alpha value back and settles with that value.

the timeline code:

JPanel text = new JPanel();
text.setVisible(true);
text.setLocation(0, 150);
text.setSize(200, 150);
text.setBackground(new Color(0, 0, 0, 180));

final Timeline rolloverTimeline = new Timeline(text);
rolloverTimeline.addPropertyToInterpolate("location", new Point(0, 150), new Point(0, 50));
rolloverTimeline.setDuration(1000);

this.addMouseListener(new MouseAdapter() {
    @Override
    public void mouseEntered(MouseEvent e) {
        rolloverTimeline.play();
    }

    @Override
    public void mouseExited(MouseEvent e) {
        rolloverTimeline.playReverse();
    }
});

this.add(text);

Any help would be greatly appreciated, thanks

PS. i'd have posted it on the Trident forums, but that place is a ghost town

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.