Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added build/classes/Calc/AddOperation.class
Binary file not shown.
Binary file modified build/classes/Calc/App.class
Binary file not shown.
Binary file modified build/classes/Calc/Calculator$1.class
Binary file not shown.
Binary file modified build/classes/Calc/Calculator$10.class
Binary file not shown.
Binary file modified build/classes/Calc/Calculator$11.class
Binary file not shown.
Binary file modified build/classes/Calc/Calculator$12.class
Binary file not shown.
Binary file modified build/classes/Calc/Calculator$13.class
Binary file not shown.
Binary file modified build/classes/Calc/Calculator$14.class
Binary file not shown.
Binary file modified build/classes/Calc/Calculator$15.class
Binary file not shown.
Binary file modified build/classes/Calc/Calculator$16.class
Binary file not shown.
Binary file added build/classes/Calc/Calculator$17.class
Binary file not shown.
Binary file added build/classes/Calc/Calculator$18.class
Binary file not shown.
Binary file modified build/classes/Calc/Calculator$2.class
Binary file not shown.
Binary file modified build/classes/Calc/Calculator$3.class
Binary file not shown.
Binary file modified build/classes/Calc/Calculator$4.class
Binary file not shown.
Binary file modified build/classes/Calc/Calculator$5.class
Binary file not shown.
Binary file modified build/classes/Calc/Calculator$6.class
Binary file not shown.
Binary file modified build/classes/Calc/Calculator$7.class
Binary file not shown.
Binary file modified build/classes/Calc/Calculator$8.class
Binary file not shown.
Binary file modified build/classes/Calc/Calculator$9.class
Binary file not shown.
Binary file added build/classes/Calc/Calculator$AddOperation.class
Binary file not shown.
Binary file added build/classes/Calc/Calculator$DivOperation.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added build/classes/Calc/Calculator$MultOperation.class
Binary file not shown.
Binary file added build/classes/Calc/Calculator$Operation.class
Binary file not shown.
Binary file not shown.
Binary file added build/classes/Calc/Calculator$SubOperation.class
Binary file not shown.
Binary file modified build/classes/Calc/Calculator.class
Binary file not shown.
36 changes: 36 additions & 0 deletions build/classes/Calc/Calculator.form
Original file line number Diff line number Diff line change
Expand Up @@ -929,6 +929,42 @@
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JButton" name="jButton1">
<Properties>
<Property name="text" type="java.lang.String" value="jButton1"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="130" y="50" width="-1" height="-1"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JButton" name="btnUndo">
<Properties>
<Property name="text" type="java.lang.String" value="Undo"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnUndoActionPerformed"/>
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="20" y="0" width="-1" height="20"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JButton" name="btnRedo">
<Properties>
<Property name="text" type="java.lang.String" value="Redo"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnRedoActionPerformed"/>
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="100" y="0" width="-1" height="20"/>
</Constraint>
</Constraints>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="titleBar">
Expand Down
Binary file added build/classes/Calc/CalculatorFacade.class
Binary file not shown.
Binary file added build/classes/Calc/CalculatorState.class
Binary file not shown.
Binary file added build/classes/Calc/Command.class
Binary file not shown.
Binary file added build/classes/Calc/ComputeCommand.class
Binary file not shown.
Binary file added build/classes/Calc/DivOperation.class
Binary file not shown.
Binary file added build/classes/Calc/HistoryOperation.class
Binary file not shown.
Binary file added build/classes/Calc/IdleState.class
Binary file not shown.
Binary file added build/classes/Calc/LoggingOperation.class
Binary file not shown.
Binary file added build/classes/Calc/MultOperation.class
Binary file not shown.
Binary file added build/classes/Calc/Operation.class
Binary file not shown.
Binary file added build/classes/Calc/OperationDecorator.class
Binary file not shown.
Binary file added build/classes/Calc/OperationFactory.class
Binary file not shown.
Binary file added build/classes/Calc/OperationSelectedState.class
Binary file not shown.
Binary file added build/classes/Calc/ResultState.class
Binary file not shown.
Binary file added build/classes/Calc/SubOperation.class
Binary file not shown.
Binary file added build/classes/Calc/TypingState.class
Binary file not shown.
2 changes: 1 addition & 1 deletion nbproject/private/private.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ do.jlink=true
javac.debug=true
javadoc.preview=true
jlink.strip=false
user.properties.file=C:\\Users\\SasUke UtChiHa\\AppData\\Roaming\\NetBeans\\15\\build.properties
user.properties.file=C:\\Users\\Sulta\\AppData\\Roaming\\NetBeans\\27\\build.properties
6 changes: 5 additions & 1 deletion nbproject/private/private.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
<group/>
<group>
<file>file:/C:/Users/Sulta/OneDrive/Documents/NetBeansProjects/calculator-java-swing-refactor/src/Calc/App.java</file>
<file>file:/C:/Users/Sulta/OneDrive/Documents/NetBeansProjects/calculator-java-swing-refactor/src/Calc/Calculator.java</file>
<file>file:/C:/Users/Sulta/OneDrive/Documents/NetBeansProjects/calculator-java-swing-refactor/src/Calc/CalculatorFacade.java</file>
</group>
</open-files>
</project-private>
13 changes: 13 additions & 0 deletions src/Calc/AddOperation.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

package Calc;

/**
*
* @author Sulta
*/
public class AddOperation implements Operation{
@Override
public float apply(float a, float b) {
return a + b;
}
}
21 changes: 13 additions & 8 deletions src/Calc/App.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
package Calc;

/**
*
* @author youcefhmd
*/

public class App {

public static void main(String[] args) {
new Calculator().setVisible(true);
}
javax.swing.SwingUtilities.invokeLater(() -> {

CalculatorFacade calcFacade = new CalculatorFacade();

// بدل ما نستدعي Calculator مباشرة:
calcFacade.showCalculator();

// مثال تشغيل:
float result = calcFacade.performOperation("+", 5, 3);
System.out.println("Result = " + result);
});
}
}

//
36 changes: 36 additions & 0 deletions src/Calc/Calculator.form
Original file line number Diff line number Diff line change
Expand Up @@ -929,6 +929,42 @@
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JButton" name="jButton1">
<Properties>
<Property name="text" type="java.lang.String" value="jButton1"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="130" y="50" width="-1" height="-1"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JButton" name="btnUndo">
<Properties>
<Property name="text" type="java.lang.String" value="Undo"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnUndoActionPerformed"/>
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="20" y="0" width="-1" height="20"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JButton" name="btnRedo">
<Properties>
<Property name="text" type="java.lang.String" value="Redo"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnRedoActionPerformed"/>
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="100" y="0" width="-1" height="20"/>
</Constraint>
</Constraints>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="titleBar">
Expand Down
Loading