Skip to content

Commit

Permalink
Added fix into version 1.0 beta
Browse files Browse the repository at this point in the history
The version 1.0 is coming

- Fix distance list and details in jFileChooser
- Fixed Problem Cursor frame with addictional control into JTabbedPan for mouse hover
- Added Adapter BasicTabbedPaneUI and add support to tabbedpaneUI style material
- Add bold into JDialog Title when it's pain with style material
- Added support tu JTree style material
- Added support to difference tra button focusable and default
- Add button exit on JDialog
- add new method into MaterialManagerListener now remove only listener MaterialTimer
  • Loading branch information
vincenzopalazzo committed May 18, 2019
1 parent 72a6e5f commit 379f4ad
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 10 deletions.
7 changes: 7 additions & 0 deletions change.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
## Fixing
- Fix distance list and details in jFileChooser
- Fixed Problem Cursor frame with addictional control into JTabbedPan for mouse hover
- Added Adapter BasicTabbedPaneUI and add support to tabbedpaneUI style material
- Add bold into JDialog Title when it's pain with style material
- Added support tu JTree style material
- Added support to difference tra button focusable and default
- Add button exit on JDialog
- add new method into MaterialManagerListener now remove only listener MaterialTimer
Binary file modified demos/Demo-Swing-set3.tar
Binary file not shown.
Binary file modified libs/material-ui-swing-1.0_Beta.jar
Binary file not shown.
5 changes: 3 additions & 2 deletions src/MaterialUISwingDemo.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import mdlaf.animation.MaterialUIMovement;
import mdlaf.utils.MaterialColors;
import mdlaf.utils.MaterialImageFactory;
import mdlaf.utils.MaterialManagerListener;
import org.jdesktop.swingx.JXTaskPane;
import javax.swing.*;
import javax.swing.border.TitledBorder;
Expand Down Expand Up @@ -453,7 +454,6 @@ public void actionPerformed(ActionEvent e) {
panel4.add(listDay);

tp.addTab("Panel 4", panel4);

frame.pack();
frame.setVisible(true);
frame.setLocationRelativeTo(null);
Expand All @@ -462,6 +462,7 @@ public void actionPerformed(ActionEvent e) {
double megamemori = (lastUsedMem - beforeUsedMem) * 9.537 * Math.pow(10, -7);
memoryOccupedNow.setText("Memory occuped after update: " + megamemori + " MB");

SwingUtilities.updateComponentTreeUI(frame);
//For testing
//SwingUtilities.updateComponentTreeUI(frame);
}
}
1 change: 1 addition & 0 deletions src/mdlaf/MaterialLookAndFeel.java
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@ protected void initComponentDefaults(UIDefaults table) {
table.put("TabbedPane.highlight", MaterialColors.GRAY_200);
table.put("TabbedPane.borderHighlightColor", MaterialColors.GRAY_300);
table.put("TabbedPane[focus].colorLine", MaterialColors.COSMO_BLUE);
table.put("TabbedPane[MouseHover].enable",true);

table.put("Table.selectionBackground", MaterialColors.GRAY_100);
table.put("Table.selectionForeground", MaterialColors.BLACK);
Expand Down
5 changes: 3 additions & 2 deletions src/mdlaf/components/tabbedpane/BasicTabbedPaneUIAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/

package mdlaf.components.tabbedpane;

import mdlaf.MaterialLookAndFeel;
Expand Down Expand Up @@ -81,14 +80,16 @@ public static ComponentUI createUI(JComponent c) {
}

public void installUI(JComponent c) {
super.installUI(c);
this.tabPane = (JTabbedPane)c;

calculatedBaseline = false;
rolloverTabIndex = -1;
focusIndex = -1;
c.setLayout(createLayoutManager());
installComponents();
installDefaults();
installListeners();
installKeyboardActions();

}

Expand Down
6 changes: 4 additions & 2 deletions src/mdlaf/components/tabbedpane/MaterialTabbedPaneUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,9 @@ protected void paintFocusIndicator(Graphics g, int tabPlacement, Rectangle[] rec
protected void paintTab(Graphics g, int tabPlacement, Rectangle[] rects, int tabIndex, Rectangle iconRect, Rectangle textRect) {
// for some reason tabs aren't painted properly by paint()
super.paintTab(MaterialDrawingUtils.getAliasedGraphics(g), tabPlacement, rects, tabIndex, iconRect, textRect);
component.addMouseMotionListener(new MouseHoverTab(rects));
if(UIManager.getBoolean("TabbedPane[MouseHover].enable")){
component.addMouseMotionListener(new MouseHoverTab(rects));
}
}


Expand All @@ -136,7 +138,7 @@ protected void paintLine(Graphics graphics, int x, int y, int w, int h) {
/**
* Event listener for mouse hover
*/
protected class MouseHoverTab implements MouseMotionListener {
public class MouseHoverTab implements MouseMotionListener {

private Rectangle[] rectangles;

Expand Down
10 changes: 6 additions & 4 deletions src/mdlaf/utils/MaterialManagerListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@
package mdlaf.utils;

import mdlaf.animation.MaterialUITimer;
import mdlaf.components.tabbedpane.MaterialTabbedPaneUI;

import javax.swing.*;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;

/**
* @author https://github.com/vincenzopalazzo
Expand All @@ -51,13 +53,13 @@ public static void removeAllMouseListener(JButton button){
* Look this if you would change this function
* https://bugs.java.com/bugdatabase/view_bug.do?bug_id=4380536
*/
public static void removeAllMaterialMouseListener(JButton button){
if(button == null){
public static void removeAllMaterialMouseListener(JComponent component){
if(component == null){
throw new IllegalArgumentException("Argument is null");
}
for(MouseListener mouseListener : button.getListeners(MouseListener.class)){
for(MouseListener mouseListener : component.getListeners(MouseListener.class)){
if (mouseListener instanceof MaterialUITimer){
button.removeMouseListener(mouseListener);
component.removeMouseListener(mouseListener);
}
}
}
Expand Down

0 comments on commit 379f4ad

Please sign in to comment.