Open the Print & Fax application from System Preferences.
Press the + button to add a printer.
From the top of the window, press the IP button.
Enter the following:
Protocol: HP Jetdirect - Socket
At this point, the application should be able to connect to the printer and fill out the Print Using option. If you want to change the Name field, you can put any text in the field.
Press the Add button.
Now repeat the above with hp4300-331.
You may want to modify the default settings to enable options like duplex mode.